1.

The let keyword cannot be used ___________(a) as a substitute of var(b) as a block statement to define new variables(c) to define variables that are scoped to a single expression(d) in a else if loop, as a substitute for varI have been asked this question in an interview for job.My enquiry is from JavaScript Extensions topic in division Classes and Modules in JavaScript of JavaScript

Answer»

Right option is (d) in a else if LOOP, as a substitute for var

The explanation is: The LET keyword can be used in FOUR ways :

as a VARIABLE declaration like var;

in a for or for/in loop, as a substitute for var;

as a block statement, to define new variables and explicitly delimit their scope; and

to define variables that are scoped to a single EXPRESSION.



Discussion

No Comment Found

Related InterviewSolutions