Interview Questions

1. Difference between var and let keyword in javascript.

  1. From the beginning, the 'var' keyword was used in JavaScript programming whereas the keyword 'let' was just added in 2015.
  2. The keyword 'Var' has function scope. Anywhere in the function, the variable specified using var is accessible but in ‘let’ the scope of a variable declared with the 'let' keyword is limited to the block in which it is declared. Let's start with a Block Scope.
  3. In ECMAScript 2015, let and const are hoisted but not initialized. Referencing the variable in the block before the variable declaration results in a ReferenceError because the variable is in a "temporal dead zone" from the start of the league until the declaration is processed.
By Md Riyazuddin 2 0
Is this helpful? Yes No

Submit an interview question

Submitted questions and answers are subject to review and editing, and may or may not be selected for posting, at the sole discretion of w3Sniff.

Get Started

Comments

Leave a Comment


Check out more interview questions

Based on your skills

MS SQL Server

2567290 1720 50 859

Angular

67716 92 0 46

Wordpress

57019 72 1 36