5 JavaScript Concepts you have To Know

There is a lot to learn in JavaScript but in this article, I’II break it down and tell you the five most important things you need to learn in JavaScript .

JavaScript is one of the languages of choice for many developers today preparing for the questions you’ll face in the job interview can be tricky whether you’ve been developing 10 months or 10 years. Ultimately, it’s important to keep in mind that JavaScript is a tool designed to solve a problem-and that problem can be solved in different ways.

Equality (==)

The equality operator (==) checks whether its two operands are equal, returning a Boolean result. It attempts to convert and compare operands that are of different types.

1 console. log(1 = 1);
2 // expected output: true
4 console. log( "hello' == 'hello ');
5 // expected output: true
7 console. log( '1' == 1);                                       >true
8 // expected output: true                                       >true
9                                                                >true
10 console. log (0 == false);                                    >true
11 // expected output: true

Async Javascript  

Using a sync simply implies that a promise will beĀ  returned, and if a promise is not returned, JavaScript Script automatically wraps it in a resolved promise with its value.


1 function resolveAfter 2Seconds ( ) {
2 return new Promise (resolve => {
3 setTimeout (( ) => {
4 resolve( 'resolved ');
5  }, 2000);
6 } );
9 async function asyncCall( ) { 
10 console. log( 'calling'); 
11 const result = await resolveAfter2Seconds ();
12 console.log(result);                                  >"calling"
13 / / expected output: "resolved"                       >"resolved"
14 }

Error Handling

The try statement defines a code block to run (to try).

The catch statement defines a code block to handle any error.

The final statement defines a code block to run regardless of the result.

The throw statement defines a custom error.

ES6 Syntax

JavaScript ES6 brings new syntax and new awesome features to make your code more modern and more readable. It allows you to write less code and do more. ES6 introduces us to many great features like arrow functions, template strings, class destruction, Modules… and more.

Array Methods

The JavaScript Array class is a global object that is used in the construction of arrays; which are high-level, list-like objects.

Common operations are create, access, loop, add an item, remove an item, find the index of an item and copy.

Leave a Reply

Your email address will not be published.