Important things of JavaScript

Primitive Values:
Primitive values in JavaScript are number, string, null, undefined, and booleans.
console.log(17);console.log(‘Hello’);console.log(undefined);console.log(null);
Non-primitive Values:
Non-primitive Value in JavaScript is an object
const person = { name: ‘Fahim’, age: ‘20’ };
Objects
In JavaScript, a variable contains only one value. Objects are variable, but they can contain many values.
const person = { name: ‘Fahim’, age: 21, eyeColor: ‘Black’ };
Functions:
In JavaScript, the function is a set of statements and they can perform a particular task.
Syntax:
function function-name ( parameter1, parameter2, …….. , parameterN ) { // statements}
Example:
function add( x, y ) {return x + y;}
Arrow functions
Arrow functions in ES6. It is a set of statements (with a parameter or without parameter ) and it can perform a particular task.
Syntax:
function-name = ( parameter ) => {// statement}
Example:
const add = ( x, y) => {return x + y;}
Hoisting:
In JavaScript, a variable declared for after use. Hoisting in JavaScript is a behavior in which a function or a variable can be used before declaration.
Example:
let x; // declared xx = 10; // assign value of x
Error Handling
Error handling in JavaScript has to terms try and catch. The try statement lets you test for errors to block a code and catch statement handle error.
Syntax:
try{//statement}catch(error){//statement}
Comments:
There are two types of comments in JavaScript. They are- single-line comments and multiline comments.
Single line comment:
Single line comment starts with //.
// single line commentconsole.log(‘ok’);
Multi-line comment:
Multi-line comment starts with /* and ends with */.
/* multiline commentExample commentdemo comment */console.log(‘ok’);