Next Generation JavaScript Features

Next Generation JavaScript Features

A brief introduction into some core next-gen JavaScript features. let and const let and const basically replace var . You use let instead of var and const instead of var if you plan on never re-assigning this "variable". The value of const can’t be changed.

let and const

let and const basically replace var . You use let instead of var and const instead of var if you plan on never re-assigning this "variable". The value of const can’t be changed.

ES6 Arrow Functions

Arrow functions are a different way of creating functions in JavaScript. Besides a shorter syntax, they offer advantages when it comes to keeping the scope of the this keyword. Arrow function syntax may look strange but it’s actually simple.

For no arguments, use empty parentheses in the function declaration:

const animalName = () => {
    console.log('Lion');
};

For one argument, omit the parentheses:

const animalName = (animal) => {
    console.log(animal);
};

For only returning a value,use the following shortcut:

const animalName = (animal) => animal;

/*which is equal to*/
const animalName = (animal) => {
    return animal;
};

Exports & Imports

In React projects (and actually in all modern JavaScript projects), you split your code across multiple JavaScript files — so-called modules. You do this, to keep each file/ module focused and manageable.

To still access functionality in another file, you need export (to make it available) and import (to get access) statements. You got two different types of exports: default (unnamed) and *named *exports:

spread-operator javascript es6-features exports-and-imports destructuring

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

JavaScript: Spread Operator and Rest Parameter (ES6)

The three magical dots (…) of JavaScript. The spread operator and rest parameter are two other powerful features introduced in ECMAScript 2015 and they allow us to write more concise and flexible code like most of the other ES6 features do. The several different ways you can use spread and rest syntax will be covered in this article.

Array Destructuring in JavaScript

Destructuring is a convenient way of extracting multiple values from data stored in objects and Arrays. ES6 introduced some significant improvements to the language, including the de-structuring of Objects and Arrays. Honestly speaking, these are my favorite edition in the JavaScript standard syntax.

Rest Parameter and Spread Operator

Two different concepts with the same syntax. Rest Parameter and Spread Operator. A Rest Parameter is used as the last argument of a function declaration. It is enabling the user to specify any number of parameters. Arguments is an Array-like Object; we cannot directly apply Array-functions to it. We have to make use of the Spread Operator to unfold the Arguments Object in an Array first.

JavaScript Spread Operator (ES6 Tutorial)

Learn JavaScript Spread Operator (ES6 Tutorial). Using the spread operator in JavaScript (ES6) can be helpful in our daily programming lives. we are going to talk about the JavaScript Spread Operator, what it does, how to use it with some examples including arrays, objects, and functions.

JavaScript Spread Operator Explained (ES6)

Learn using the spread syntax with JavaScript arrays, objects, and functions. Using the spread operator in JavaScript (ES6) can be helpful in our daily programming lives. We are going to talk about the JavaScript Spread Operator, what it does, how to use it with some examples including arrays, objects, and functions.