Computer Science, asked by neerajsemwal7359, 1 year ago

The main difference between the variables declared with var and with let is
A.var is confined to a particular function but let is not
B.let is confined to a particular function but var is not
C.var defines values based on conditions but let does not
D.none of the mentioned

Answers

Answered by Neeraj723
2
______✨ HEY MATE ✨______

➡️Option (B) is the right answer ✔️


✌✌Hope it's help u ✌✌
Answered by amardeeppsingh176
0

Answer:

Explanation:

The main difference between the variables declared with var and with let is let is confined to a particular function but var is not .

Var-declared variables are defined throughout the entire enclosing function. Only the next enclosing block can define variables declared using let (and any blocks nested within it, of course).

In JavaScript, there are some differences between var, let, and const variable declarations:

  • The scope of variables declared with the var and const keywords is the current function body.
  • The var keyword declares variables that are hoisted. Hoisting describes the ability to access a variable in its surrounding scope even before it has been declared.
  • Let-declared variables are block-scoped, which means that they only apply to the current block in which they are declared.

#SPJ2

Similar questions