Most javaScript Interview Question

01 Is javascript case-sensitive?

Mehedisabuj
3 min readJun 9, 2021
  • forEach() — Well, the forEach() method doesn’t actually return anything (undefined). It simply calls a provided function on each element in your array. This callback is allowed to mutate the calling array.
  • map() — Meanwhile, the map() method will also call a provided function on every element in the array. The difference is that map() utilizes return values and actually returns a new Array of the same size.

02 Is javaScript sync or async ? explain it.

what is function ?

Answer: A JavaScript function is a block of code designed to perform a particular task. A JavaScript function is executed when “something” invokes it (calls it).

what is callback ?

Answer — This function that is passed as an argument inside of another function is called a callback function.

what is the difference between array and object ?

  1. In JavaScript, a truthy value is a value that is considered true when encountered in a Boolean context. All values are truthy unless they are defined as falsy (i.e., except for false, 0, -0, 0n, “”, null, undefined, and NaN).

what is Truthy and Falsy values?

what is map?

answer : The map() method creates a new array with the results of calling a function for every array element. The map() method calls the provided function once for each element in an array, in order. Note: map() does not execute the function for array elements without values.

what is the difference between map and forEach?

what is NAN?

The NaN property represents “Not-a-Number” value. This property indicates that a value is not a legal number. The NaN property is the same as the Number.

  1. What are closures?
  2. A closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment). … In JavaScript, closures are created every time a function is created, at function creation time
  3. What is hoisting?
  4. In JavaScript, Hoisting is the default behavior of moving all the declarations at the top of the scope before code execution. Basically, it gives us an advantage that no matter where functions and variables are declared, they are moved to the top of their scope regardless of whether their scope is global or local.8 Jan 2020
  5. Difference between function declaration and arrow function?
  6. 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.
  7. Define ES6 and mention the new features of ES6?
  8. ES6. ECMAScript 6 — New Features: Overview & Comparison. See how cleaner and … only in ES5 through the help of object properties // and only in global context and not in a … defineProperty(typeof global === “object” ? global : window, “PI”, { value: … var list = [ 1, 2, 3 ]; var a = list[0], b = list[2]; var tmp = a; a = b; b = tmp;.
  9. What is default parameter?
  10. The default parameter is a way to set default values for function parameters a value is no passed in (ie. it is undefined ). In a function, Ii a parameter is not provided, then its value becomes undefined . In this case, the default value that we specify is applied by the compiler.26 Oct 2019
  11. Rest parametre?

The rest parameter syntax allows a function to accept an indefinite number of arguments as an array, providing a way to represent variadic functions in JavaScript …rest parametr

--

--