1.

The lexical scooping in JavaScript is based on which of the following?(a) Segments(b) Blocks(c) Functions(d) Entire codeThis question was addressed to me during an interview.Query is from JavaScript Benchmarking and Logging with perfLogger in division Parsing, Benchmarking and Logging of JavaScript

Answer» RIGHT option is (c) FUNCTIONS

To EXPLAIN: Lexical scoping (sometimes known as static scoping) is a convention used with many programming languages that sets the SCOPE (range of functionality) of a variable so that it may only be called (REFERENCED) from within the block of code in which it is defined. JavaScript has lexical scoping based on functions but not blocks.


Discussion

No Comment Found

Related InterviewSolutions