JS Code Snippets const Keyword

Javascript const Keyword

In this code snippet, we’ll learn about the const keyword in Javascript. The const keyword does almost exactly the same thing to a variable as the let keyword. You can read more about let in this post. The difference is it also makes the variable a constant meaning it can only have its value assigned once.

JS Code Snippets let Keyword

Javascript let Keyword

In this code snippet, we’ll learn about the let keyword in Javascript. Javascript allows for some pretty weird stuff with variables like using them before being declared, declaring the same variable, multiple times and no variable scope.

JS Code Snippets For Of And For In Loops

Javascript For Of And For In Loop

In this code snippet, we’ll check out the for of loop in Javascript. You probably already know about the for and while loops. But there is another very useful type of loop present in Javascript called the “for of” loop. It can be used to iterate throught iterable object. I would say it’s the quivalent of the foreach loop in C#.

Javascript Code Snippets Copying An Array

Copying Arrays in Javascript

In this post, we’ll learn how to copy an array in Javascript. In Javascript, if you assign an array to another array using the = assignment operator you won’t actually copy the values from one array into the other. What you will do is make another reference to the first array, so now you just have to variables pointing at the same array.

JS Code Snippets

Javascript Code Snippets

This post contains a list Javascript code snippets. In the code snippets, you can find Javascript related topics with a quick explanation and a code example. I made this collection of code snippets so that if I ever forget something I can just come here to refresh my memory.

Advertisment ad adsense adlogger