Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
July 25, 2022 04:39 am GMT

Features of JavaScript - That You Should Know

JavaScript is a front-end language, the most utilized language nowadays by developers to design web pages or web applications. Developers use this language to make a transcendent framework to make their work more attractive. ECMAScript version(ES6+) of JavaScript is the latest version now to use and there are lots of advanced functions.

Features of JavaScript

1. Style Console Log

you know that? you can style the console log by using JavaScript. To customize the console log you need to add CSS on it to get the console log. If you want to print the source code you need to add %c before the code and then add console.log() after it. But it requires CSS to variable to execute it.

If you want to customize the variable in comparison to others you need to use %c and console.log() before it. And add CSS properties as you want in it.

Let's see the example:

Image description

2. Use Shorthand Operators

ES6 has a shorthand to define operators in a short way. And this is an operator that no one can talk about simply because they don't know about it. This operator makes your work easy and fast. And it looks very clean and neet to read and understand.
Let's see the example:

Image description

3. Elective Chaining

Chaining ?. is used to check properties before ?. if it's null or undefined then it returns undefined otherwise its returns the value.

Developers have a lot of work and projects to complete before a time. Source code has large objects, nested loops, containers, for that to check the property.

Let's see the example:

Image description

4. Use Generator Function

This is a function that similar to common functions the only difference between them is Generator function stops the execution on a particular line when you want and continue when you want. To create the generate function you need to use * after keyword of function.

Let's see the example:

Image description

5. Use in Keyword

in keyword is used to check the properties are available in an object or not. After using this keyword you can get the true or false value its depend on the value that available in an object or not.

Let's see the example:

Image description


Original Link: https://dev.to/devsimc/features-of-javascript-that-you-should-know-43hm

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To