JavaScript is the language of the net. If you wish to code for the net, you want to know JavaScript in and out. This course will aid you study JavaScript,
This course is 7 hours half-hour lengthy, and it’s break up into 78 classes in complete. You’ll discover it’s an important useful resource that you’ll come again to usually so be sure you bookmark the elements that curiosity you.
Who’s This FREE Course For?
- Full freshmen who need to be internet builders
- Skilled builders who need to discover superior subjects
- Programming fans who take pleasure in studying one thing thrilling
Observe Alongside, Study by Doing
I encourage you to follow together with this course and you will find out about all crucial options of JavaScript.
To assist, the Fashionable Javascript Fundamentals course GitHub repository accommodates the supply code for every lesson and the finished pattern venture that was constructed all through the course.
1. What You Will Study in This Free JavaScript Course
Watch video lesson [0:00:00] ↗
Welcome to Fashionable JavaScript Fundamentals. On this introductory lesson we’ll check out the scope of the course.
Here’s what we’ll cowl:
- basic ideas: variables, task, operators
- information varieties: arrays, objects, maps, units
- program management: conditionals, loops, iterators
- JavaScript built-ins: varieties, JSON,
Math
, dates and occasions - capabilities: scope, closures, prototypes,
this
, arrow capabilities, mills - superior languauge options: guarantees, destructuring, common expressions, lessons
- internet APIs: the DOM, the Selector API, geolocation, internet storage, internet staff
Setup
Watch video lesson [0:00:10] ↗
Let’s get our improvement space arrange and prepared for coding! On this lesson I’ll present you the way.
To arrange JavaScript and our working atmosphere, we’ll use the next instruments:
2. Language Fundamentals
Variables
Watch video lesson [0:07:46] ↗
On this lesson we’ll have a look at one of the vital basic models of a JavaScript program—the common-or-garden variable. We’ll see the totally different ways in which a variable will be declared after which assigned a worth, and another common bits of details about variables that it is best to most likely pay attention to.
Information Varieties
Watch video lesson [0:14:07] ↗
On this lesson we’ll check out the totally different information varieties that can be utilized in JavaScript and what every kind can be utilized for. We’ll cowl primitives, composites, and particular information varieties.
Arithmetic, Task, and Comparability Operators
Watch video lesson [0:25:21] ↗
Particular characters like +
and -
can be utilized in numerous mixtures to carry out operations on various things. Let’s see how among the extra primary operators, like arithmetic, task, and comparability operators behave.
Unary, Logical, Comma, and Unfold Operators
Watch video lesson [0:34:56] ↗
On this lesson we’ll proceed JavaScript’s many operators. This time we’ll concentrate on unary operators, logical operators, the comma operator, and the unfold operator.
Exponentiation and Logical Task Operators
Watch video lesson [0:42:57] ↗
On this lesson we’ll have a look at exponentiation operators and logical task operators.
Operator Priority
Watch video lesson [0:47:32] ↗
Not all operators are created equal! On this lesson we’ll see the order by which operators are evaluated when a couple of kind of operator is utilized in an expression.
Reserved Phrases
Watch video lesson [0:51:05] ↗
Some phrases in JavaScript are particular and cannot be used as identifiers. Let’s simply take a second to evaluate these to ensure we do not trigger surprising errors in our packages.
Numeric separators
Watch video lesson [0:53:50] ↗
Numeric separators make working with massive constants a bit simpler.
Lengthy numbers will be onerous to learn. Right here the numeric separators make it simple to see the quantity is one billion.
const hardToRead = 1000000000; const easierToRead = 1_000_000_000;
Strict Mode
Watch video lesson [0:55:45] ↗
Strict mode is a helpful execution mode for JavaScript that may forestall many errors and will all the time be used. On this lesson we’ll study all about it.
For instance, the next perform, in strict mode, will throw a a compile-time exception about assigning to NaN
. The concept is to catch a mistake if you compile the code, as an alternative of ready for this system to fail if you run it.
perform strict() { 'use strict'; NaN = 'oops'; console.log(NaN); }
Nullish Coalescing & Optionally available Chaining
Watch video lesson [0:59:28] ↗
On this part we’ll study concerning the nullish coalescing operator: ??
. Nullish coalescing makes it simple to retrieve the worth of an expression, or some default worth if that expression is null.
Listed here are a few examples of nullish coalescing in operation:
const rely = null; console.log(rely ?? 10); //10 const rely = 0; console.log(rely ?? 10); //0
Capabilities
Watch video lesson [1:03:11] ↗
Capabilities are the cornerstone of JavaScript. On this lesson we’ll have a look at some primary options of capabilities.
Here’s a very primary instance of a perform that simply logs a message to the console:
perform logMe(message) { console.log("The message is: " + message); } logMe("a message!"); logme("a special message!");
3. Information Constructions
Arrays
Watch video lesson [1:13:52] ↗
Arrays are one of the vital generally used constructions for storing information, and you’ll use them on a regular basis. On this lesson we’ll concentrate on the fundamentals: what arrays are and the way they are often created, accessed, and modified.
Here is a easy instance of an array of varieties of fruit. Notice that an array can have duplicates.
const fruits = []; fruits.push('banana', 'apple', 'peach', 'apple'); console.log(fruits.size); // 4
Objects
Watch video lesson [1:18:18] ↗
Objects are a basic idea in JavaScript, and finally, most entities are objects in a technique or one other. On this lesson we’ll concentrate on how objects will be created, and the totally different ways in which their properties will be accessed
Units
Watch video lesson [1:22:46] ↗
Units are JavaScript objects that retailer distinctive values of any kind. Set
is likely one of the assortment lessons lately added to JavaScript.
Not like arrays, units can’t have duplicates:
const fruitArray = ['apple','banana','pineapple', 'banana']; const fruitSet = new Set(fruitArray); console.log(fruitArray.size); // 4 console.log(fruitSet.dimension); //3
Maps
Watch video lesson [1:27:38] ↗
Maps are objects that retailer key, worth pairs. Within the case of maps, each the keys and values will be of any kind.
Weak Maps and Weak Units
Watch video lesson [1:31:57] ↗
Following on the earlier lesson, let’s check out WeakSet
s and WeakMap
s. A WeakSet
accommodates weakly referenced distinctive objects, whereas a WeakMap
has weakly referenced objects as keys.
4. Controlling Program Execution
Conditionals
Watch video lesson [1:36:22] ↗
What occurs when we have to do one factor if a situation is true, or one thing else if it isn’t? We use an if assertion, that’s what, and on this lesson we’ll study all about if statements and the ternary operator.
Here is an instance of utilizing a ternary operator:
let quantity = 5 let description = quantity <= 3 ? 'few' : 'many'; console.log(description); // "many"
Strive Catch
Watch video lesson [1:43:50] ↗
When code throws errors, how do you catch them? On this lesson we’ll see how.
Swap Statements
Watch video lesson [1:46:46] ↗
Much like an if is the change assertion, which permits us to take a special code path based mostly on the worth of one thing. I’ll present you the way it works on this lesson.
The For Loop
Watch video lesson [1:51:16] ↗
Probably the most primary method of iterating a knowledge construction is the for loop. Let’s check out the way it works.
This instance builds a string with 9 *
characters. In fact it could be simple to onerous code this, however what if it was ninety characters? Or 9 thousand?
let str=""; let n = 9 for (let i = 0; i < n; i++) { str = str + "*"; } console.log(str); // "*********"
The `for .. in` Loop
Watch video lesson [1:57:03] ↗
Whereas a traditional for loop is used for iterating arrays, a for .. in
loop is used to iterate objects.
The `for .. of` Loop
Watch video lesson [2:01:56] ↗
The for .. of
loop is a brand new assemble that enables us to iterate over the values in a set as an alternative of the keys. Let’s check out how we will use it to iterate arrays, maps, or different iterable objects.
Iterators
Watch video lesson [2:05:35] ↗
Let’s study concerning the iteration protocol and see how one can iterate among the information constructions that we checked out earlier.
Whereas Loops
Watch video lesson [2:10:31] ↗
JavaScript additionally helps two further varieties of loops: whereas and do .. whereas
loops. These loops differ from for loops in that they take a look at a situation evaluating to true or false at every iteration step, reasonably than iterating a spread of numbers or parts in an object. We’ll cowl the syntax of each whereas loop varieties and have a look at some issues of their utilization.
5. Utilizing JavaScript
Working With Strings
Watch video lesson [2:14:03] ↗
Strings have plenty of totally different properties and strategies we will use with the intention to remodel them or glean helpful data from them. Let’s see among the extra frequent issues we will do with strings.
Working With Strings: Padding, Trimming, and Changing
Watch video lesson [2:23:26] ↗
Typically when you find yourself utilizing strings you will need to do some formatting, like padding the start or finish, trimming whitespace, or changing characters. On this lesson you will see how.
Some examples of padding and trimming capabilities:
console.log(' take a look at '.trimStart()); // "take a look at " console.log(' take a look at '.trimEnd()); // " take a look at" console.log('pad me'.padStart(10)); // " pad me"
Template Literals
Watch video lesson [2:27:34] ↗
JavaScript now options native templating within the type of template literals, that are a particular kind of string that may include expressions. We are able to additionally use a barely extra superior template referred to as a tagged template. Let’s have a look at each of those options on this lesson.
Template literals are nice for constructing strings for output.
const username = "Lucas"; console.log(`Hiya ${username}!`); // "Hiya Lucas!"
Working With Numbers
Watch video lesson [2:33:02] ↗
On this lesson we’ll check out among the properties and strategies that make up the API of the built-in Quantity
object.
Working With BigInts
Watch video lesson [2:39:31] ↗
Typically a plain Quantity
shouldn’t be sufficiently big to retailer the results of a calculate. For instance, exponentiation can overflow the numeric information kind rapidly.
Here is an instance that exhibits how highly effective and simple to make use of the BigInt
kind is.
const num = 2 ** 4; // 16 const reallyBigNum = 2 ** 4 ** 5; //Infinity const bigIntNum = BigInt(2) ** BigInt(3) ** BigInt(4); //2417851639339358349412352n
Working With Arrays
Watch video lesson [2:44:08] ↗
Arrays even have quite a lot of totally different properties and strategies. Let’s evaluate probably the most generally used.
Iterating and Remodeling Arrays
Watch video lesson [2:55:10] ↗
Arrays have so many helpful strategies that I needed to break the array lesson into two elements! On this lesson, we proceed how we will work with arrays, this time specializing in strategies for iterating and remodeling them.
Looking out and Flattening Arrays
Watch video lesson [3:02:24] ↗
If you wish to discover out if an array accommodates a sure factor, then you definately’ll need to search with a way like consists of()
.
In case you have an array of arrays, you possibly can mix all the weather right into a single array with flat()
.
Working With the Object Sort
Watch video lesson [3:05:47] ↗
Object
is a particular kind of object which additionally has its personal properties and strategies. On this lesson, we find out about situations of Object
and the way they can be utilized.
Object Literal Extensions
Watch video lesson [3:18:57] ↗
Latest variations of JavaScript have launched some new instruments that we will make use of when creating object literals, together with shortcuts for outlining properties and strategies, dynamic keys, and the brand new assign
methodology.
Working With Object Situations
Watch video lesson [3:25:41] ↗
All object situations inherit properties and strategies from the prototype of their constructor. We are able to discover out whether or not a property is outlined on an object immediately or inherited from the prototype. To do that, we use the hasOwnProperty
methodology of the Object
constructor. We’ll cowl this and another Object
constructor strategies on this lesson.
Object Strategies for Keys and Values
Watch video lesson [3:32:19] ↗
Typically we have to entry the keys and values of an object as a set. The Object
class gives a lot of strategies for this, for instance keys()
and values()
.
Getters and Setters
Watch video lesson [3:36:35] ↗
In addition to common object properties, we will additionally create properties which have getters and setters, that are particular capabilities that run when the property is about or accessed.
Customized Objects
Watch video lesson [3:40:57] ↗
We’ve seen how one can create objects which have properties and strategies, however on this lesson we’ll go a bit deeper and see how one can create customized objects. We’ll additionally have a look at how one can specify whether or not properties are enumerable or configurable.
The Math
API
Watch video lesson [3:52:11] ↗
On this lesson we’ll check out the built-in Math
object, which gives properties and strategies to carry out operations on numbers.
Working With Dates and Instances
Watch video lesson [3:57:02] ↗
On this lesson, we’ll have a look at how one can work with dates and occasions in JavaScript. I’ll present you how one can create new situations of the Date
class, modify them, and output them to strings.
The Array
Constructor
Watch video lesson [4:04:50] ↗
Just like the Object
class, the Array
constructor has a few helpful strategies that we will make use of. On this lesson we’ll check out these strategies intimately.
6. Capabilities
The this
Object
Watch video lesson [4:09:45] ↗
The this
object is usually complicated to JavaScript freshmen. Relying on the context by which it’s used, this
will be sure to totally different objects. On this lesson, we’ll have a look at among the ins and outs.
Working With Capabilities
Watch video lesson [4:15:00] ↗
Capabilities are additionally objects, and as such they’ve their very own properties and strategies that we will make use of. Let’s check out among the extra frequent perform strategies.
Scope
Watch video lesson [4:24:30] ↗
Scope is a crucial and generally elusive idea in JavaScript. We have to perceive scope, so on this lesson we’ll dig in and focus completely on what it’s.
The globalThis
Property
Watch video lesson [4:31:46] ↗
In JavaScript, the worldwide object has a special identify relying on the execution atmosphere. For JavaScript within the browser it is window
, on Node.js it is world
, and in a WebWorker it is referred to as self
. That is the place globalThis
is available in—to offer constant entry to the worldwide object no mater the platform.
Arrow Capabilities
Watch video lesson [4:34:08] ↗
Arrow capabilities give us a way more concise syntax for nameless capabilities. They arrive with a number of gotchas although. For one, this
works a bit in a different way in an arrow perform. Let’s take a more in-depth have a look at how one can use arrow capabilities and the way this
works with them on this lesson.
Arrow capabilities are nice for writing quick, succinct capabilities that remodel their enter.
const numbers = [1, 2, 3, 4, 5]; console.log(numbers.map(n => n*n)); // [1, 4, 9, 16, 25]
Generator Capabilities
Watch video lesson [4:41:02] ↗
Turbines are a particular kind of perform that may be paused throughout execution utilizing a yield
expression. Let’s learn to go values in to mills, and see what comes out once we use them.
Closures
Watch video lesson [4:48:33] ↗
Closures are seen by some as a posh and tough idea to study. We’ll blast that delusion away on this lesson and find out how simple they’re to make use of.
Prototypes
Watch video lesson [4:53:30] ↗
The prototype is a particular object that has an enormous significance for JavaScript inheritance. Prototypes are a robust mechanism, and you will need to perceive them effectively.
Unfold Syntax
Watch video lesson [4:59:53] ↗
The unfold syntax is a concise strategy to broaden an array or different iterable into an arbitrary variety of perform arguments or array parts.
An ideal use of the unfold syntax is for frequent array operations like cloning, concatenation, and so forth.
const a = [1, 2, 3]; const b = [4, 5, 6]; //create a duplicate of a const copyA = [...a]; //modifications to this copy won't have an effect on a copyA.unshift(0); console.log(a); // [1, 2, 3] //concatenate a and b console.log([...a, ...b]); // [1, 2, 3, 4, 5, 6] //add parts to the start and finish of a console.log([0, ...a, 0]); // [0, 1, 2, 3, 0]
Default and Relaxation Parameters
Watch video lesson [5:02:19] ↗
On this lesson, we will check out two further perform options, each to do with parameters: default parameters and relaxation parameters.
7. Miscellaneous
Destructuring Assignments
Watch video lesson [5:07:21] ↗
JavaScript has built-in help for destructuring arrays and objects into particular person variables throughout task. It is a actual time-saver. On this lesson I’ll present you the way to do that, in addition to how one can destructure parameters in perform calls.
Destructuring makes it simple to interrupt an array or object out into particular person variables.
const a = [0, 1, 2]; const [x, _, y] = a; console.log(x); // 0 console.log(y); // 2
AJAX
Watch video lesson [5:15:28] ↗
AJAX (Asynchronous JavaScript and XML) is a cornerstone of contemporary internet apps, permitting them to fetch information from the server and show it on the web page without having to refresh or reload the whole web page. We’ll discover AJAX intimately on this lesson.
Common Expressions
Watch video lesson [5:20:50] ↗
Common expressions are a particularly highly effective strategy to discover strings in textual content based mostly on patterns. They are often terribly advanced—nearly a programming language unto themselves—however they may also be extraordinarily helpful.
Extra About Common Expressions
Watch video lesson [5:31:31] ↗
There’s nonetheless rather a lot to find out about common expressions. On this lesson, we’ll study some superior options of standard expressions, together with matching and changing strings.
Even Extra Common Expressions
Watch video lesson [5:40:01] ↗
That is not all! Common expressions are a (easy) programming language in their very own proper. We’ll discover them additional on this lesson.
Courses
Watch video lesson [5:42:54] ↗
Courses in JavaScript are a syntactic sugar that makes it simpler to make use of JavaScript’s prototype-based inheritance. On this lesson, we’ll concentrate on the way in which to create objects and cope with inheritance.
This straightforward rectangle class is aware of how one can calculate its personal space:
class Rectangle { constructor(width, top) { this.width = width; this.top = top; } space () { return this.width*this.top; } } const rect = new Rectangle(12, 16); console.log(rect.space()); // 192
Timeouts and Intervals
Watch video lesson [5:49:29] ↗
If you wish to run some code after a timed delay, or need to run code at an everyday interval, you’ll need setTimeout()
or setInterval()
.
ES Modules
Watch video lesson [5:53:34] ↗
ECMAScript Modules (ES Modules or ESM for brief) are one of many best options of JavaScript to emerge in recent times. On this lesson, I’ll present you how one can make use of them for extra modular, maintainable JavaScript.
8. Working With the DOM
Choosing HTML Components
Watch video lesson [6:01:54] ↗
On this lesson I’ll present you the totally different DOM strategies we will use to pick out parts from the web page in order that we will work with them programmatically.
Here is an instance of extracting all h2 elmeents from the web page:
Manipulating HTML Components
Watch video lesson [6:06:51] ↗
On this lesson we’ll check out the fundamental APIs for working with HTML parts and their attributes, working with parts that we’ve got beforehand chosen.
DOM Travesal
Watch video lesson [6:014:19] ↗
On this lesson we’ll see how one can traverse from one DOM node to a different with code. This can assist us map out the construction of the web page and perceive its contents.
Including and Eradicating Components
Watch video lesson [6:019:36] ↗
In addition to manipulating parts, we would need to add new ones or take away current ones. On this lesson we’ll have a look at the strategies we will use to do that.
Creating Components and Different Nodes
Watch video lesson [6:024:18] ↗
We are able to create a lot of various things, comparable to parts, attributes, and feedback, utilizing the doc
interface. We are able to additionally create a light-weight model of a doc referred to as a documentFragment
. This lets us manipulate parts in reminiscence, bettering efficiency. We’ll have a look at these subjects on this lesson.
DOM Occasions
Watch video lesson [6:028:54] ↗
DOM occasions are extraordinarily essential. They’re what permit us to create compelling, interactive internet pages. We’ll see how one can use DOM occasions to react to person and browser occasions on this lesson.
9. Internet APIs
The Selector API
Watch video lesson [6:038:37] ↗
The selector API permits us to pick out parts from the web page utilizing CSS selectors, very similar to in common JavaScript libraries comparable to jQuery.
Geolocation
Watch video lesson [6:041:10] ↗
The place on the earth are you? The Geolocation API can let you know this, even in non-mobile environments like desktop computer systems. That’s what we’ll concentrate on on this lesson.
With this code you possibly can retrieve and log the person’s place—with their permission, in fact!
navigator.geolocation.getCurrentPosition( location => console.log(location), err => console.log(err), { timeout: 1000} )
Internet Storage
Watch video lesson [6:046:24] ↗
There are a number of alternative ways by which we will retailer information between browser classes, together with localStorage
, Internet SQL, and IndexedDB. On this lesson, we’ll have a look at how we will use every of those applied sciences, and when every could be helpful.
Internet Employees
Watch video lesson [6:051:31] ↗
Internet staff present a method for us to dump advanced processing to a employee thread to keep away from blocking the principle UI thread. On this lesson we’ll see how one can use devoted staff.
10. Asynchronous JavaScript
Guarantees
Watch video lesson [6:055:03] ↗
On this lesson we’ll have a look at native JavaScript guarantees, a particular kind of object that represents an operation that hasn’t accomplished but, however which is predicted in some unspecified time in the future.
Promise Chaining
Watch video lesson [7:04:52] ↗
On this lesson we proceed guarantees, this time specializing in dealing with a number of asynchronous duties with promise chaining.
Promise Strategies: all
and any
Watch video lesson [7:10:07] ↗
What if you wish to wait on a lot of guarantees? If you wish to wait till all the guarantees have resolved, you need to use the Promise.all()
methodology. Or, if you wish to simply wait till any of them have resolved, use Promise.any()
.
The async
Key phrase
Watch video lesson [7:14:01] ↗
The async
key phrase is a current addition to the JavaScript language to make concurrent programming with guarantees even simpler to jot down and skim. On this lesson we’ll study concerning the async
key phrase, together with the place we will use it and what occurs once we do.
The await
Key phrase
Watch video lesson [7:17:19] ↗
On this lesson we’ll transfer on to have a look at the async
key phrase’s companion, the await
key phrase, which might solely be used inside async capabilities.
Extra About async
and await
Watch video lesson [7:21:16] ↗
Let’s put async
and await
by their paces by utilizing a number of awaits
in a single async
perform, and catching errors with strive...catch
.
Asynchronous Iteration
Watch video lesson [7:25:05] ↗
One other cool factor you are able to do with async
is to code asynchronous iteration with async mills.
Dynamic Imports
Watch video lesson [7:28:49] ↗
Ordinarily, an import assertion is static—it is evaluated when the JavaScript file is first loaded, so your code would not have any management over whether or not the import is run, and you’ll solely use static strings for the module identify.
Dynamic imports change all that, although. They’re evaluated as wanted, so you possibly can delay importing a module till you recognize it is wanted, and you need to use dynamic module names.
Here is how one can load a special module relying on whether or not the code is operating on the consumer or server.
let myModule; if (typeof window === "undefined") { myModule = await import("mymodule-server.js"); } else { myModule = await import("mymodule-browser.js"); }
Conclusion
Watch video lesson [7:30:58] ↗
Congratulations for finishing this course! Alongside the way in which, you have realized rather a lot about JavaScript: from the fundamentals of the language to new options which were added in recent times. Deal with this course as agency basis to proceed constructing your data.