Question No 1 : What are the differences between var, let and const?
ANSWER: var variables can be updated and re-declared within its scope; let variables can be updated but not re-declared; const variables can neither be updated nor re-declared. They are all hoisted to the top of their scope. But while var variables are initialized with undefined , let and const variables are not initialized.
Question No 2 : What are the differences between arrow function and regular function?
ANSWER: Regular functions created using function declarations or expressions are constructible and callable. Since regular functions are constructible, they can be called using the new keyword. However, the arrow functions are only callable and not constructible, i.e arrow functions can never be used as constructor functions.
Question No 3 :What are the differences between map, foreach, filter and find?
ANSWER: The Map object holds key-value pairs and remembers the original insertion order of the keys. Any value (both objects and primitive values) may be used as either a key or a value. The forEach() method executes a provided function once for each array element. The filter() method creates a shallow copy of a portion of a given array, filtered down to just the elements from the given array that pass the test implemented by the provided function. The find() method returns the first element in the provided array that satisfies the provided testing function. If no values satisfy the testing function, undefined is returned.
Question No 4 :What are the differences between var, let and const?
ANSWER: Template Literals use back-ticks (' ') rather than the quotes (" ") to define a string. With template literals, we can use both single and double quotes inside a string. Template literals provide an easy way to interpolate variables and expressions into strings. The method is called string interpolation.