New Features + Backend | Javascript Hindi Course For Beginners ( 2023 ) #16
Spread Operator
the spread operator (denoted by
...
) allows an iterable (e.g. array, string, etc.) to be expanded into individual elements.Destructuring
destructuring is a feature that allows you to extract values from arrays or objects and assign them to variables in a more concise way.
There are two types of destructuring: array destructuring and object destructuring.
Optional chaining
Optional chaining is a feature introduced in ECMAScript 2020 that allows you to safely access deeply nested properties of an object without having to manually check each property along the way.
Nullish coalescing operator ??
The nullish coalescing operator (
??
) is a feature introduced in ECMAScript 2020 that allows you to provide a default value for variables that might be null or undefined.Nullish coalescing assignment (??=)
The nullish coalescing assignment (
??=
) operator is a feature introduced in ECMAScript 2021 that allows you to assign a default value to a variable only if its current value is null or undefined.void operator
The
void
operator evaluates the given expression
and then returns undefined
.Generator function
A generator function in JavaScript is a special type of function that allows you to generate a sequence of values on the fly. It's defined using the
function*
syntax and returns an iterator object that can be used to iterate over the sequence of values.The main difference between a regular function and a generator function is that a regular function runs to completion and returns a single value, while a generator function can pause its execution and yield multiple values, one at a time, without exiting the function.
In this example,
myGenerator()
is a generator function that yields the values 1
, 2
, and 3
. When the function is called, it returns an iterator object, which can be used to iterate over the sequence of values using the next()
method.Each time the
next()
method is called, the generator function resumes execution and yields the next value in the sequence, until there are no more values left to yield. When there are no more values to yield, the done
property of the iterator object is set to true
.Generator functions can be used to generate infinite sequences of values, or to lazily compute values on demand, which can improve performance and reduce memory usage in some cases.
NPM (Node Package Manager) & Package JSON
NPM (Node Package Manager) is a package manager for JavaScript, that is used to manage and install packages and modules for Node.js projects. It is the default package manager for Node.js and comes bundled with it. NPM allows you to easily install, update, and manage dependencies for your Node.js projects.
Package.json is a configuration file for Node.js projects that contains metadata about the project, as well as a list of dependencies required for the project to run. The file is located at the root of the project directory and is created automatically when you initialize a new project using the
npm init
command.The package.json file contains information such as the project name, version, description, author, license, and keywords. It also includes a list of dependencies required for the project to run, along with their versions. This allows you to manage and track the dependencies required for your project and ensures that other developers can easily set up and run your project.
JavaScript modules
JavaScript modules are a way of organizing and structuring your code into reusable, independent units of functionality, which can be easily imported and used in other parts of your application.
Modules provide a number of benefits, including:
- Encapsulation: Modules allow you to encapsulate your code and avoid namespace collisions by keeping the implementation details of each module private and exposing only the public API.
- Reusability: Modules can be easily imported and used in other parts of your application, making it easy to reuse code and avoid duplication.
- Maintainability: Modules help to improve the maintainability of your code by breaking it down into smaller, more manageable pieces.
There are two main types of JavaScript modules:
- ES6 Modules: ES6 modules are the newer and more modern way of working with modules in JavaScript. They are built into the language and can be used natively in modern browsers and Node.js. ES6 modules use the
import
andexport
statements to define and use modules.
- CommonJS Modules: CommonJS modules are the older way of working with modules in JavaScript, and are still widely used in Node.js. CommonJS modules use the
require()
andmodule.exports
statements to define and use modules.
Spread Operators , Destructuring, Optional chaining,Nullish coalescing ,Generator function,NPM (Node Package Manager) & Package JSON,JavaScript modules Check Notes - https://dosomecoding.com/courses/javascript/javascript-hindi-course-for-beginners HTML Course https://www.youtube.com/playlist?list=PLPppPPmk0i3gL2isb9Kr1GvTM8id2gdtY CSS Course https://www.youtube.com/playlist?list=PLPppPPmk0i3gWK5TVILnKSvuc9Fc15sbH Html and CSS practice Projects https://www.youtube.com/playlist?list=PLPppPPmk0i3hZCNmbVtcP1hlwDKOdUFX9 Javascript Course https://www.youtube.com/playlist?list=PLPppPPmk0i3gZCY8JZ0H5oykFGevvNzNS Linkedin - https://linkedin.com/in/anshuopinion Telegram Channel - https://telegram.me/dosomecodinghelp Instagram - https://instagram.com/dosomecoding Github - https://github.com/anshuopinion