Interview Preparation
Some Common
Asked Questions.
Question: 06
When would the final statement in the code shown be logged to the
console? When would 'results shown' be logged to the console?
let modal = [Link]('#result');
setTimeout(function(){
[Link]('hidden);
}, 10000);
[Link]('Results shown');
after 10 second
after results are received from the HTTP request
after 10000 seconds
immediately
Question: 07
Which snippet could you add to this code to print "food" to the
console?
class Animal {
static belly = [];
eat() {
[Link]('food');
}
}
let a = new Animal();
[Link]();
[Link](/* Snippet Here */); //Prints food
[Link][0]
Object.getPrototype0f (a).belly[0]
[Link][0]
[Link][0]
Question: 08
How does a function create a closure?
It reloads the document whenever the value changes.
It returns a reference to a variable in its parent scope.
It completes execution without returning.
It copies a local variable to the global scope.
Question: 09
What is the result in the console of running the code shown?
var Storm = function () {};
[Link] = 'rain';
var WinterStorm = function () {};
[Link] = new Storm();
[Link] = 'snow';
var bob = new WinterStorm();
[Link]([Link]);
Storm()
undefined
'rain'
'snow'
Question: 10
You need to match a time value such as 12:00:32. Which of the
following regular expressions would work for your code?
/[0-9]{2,}:[0-9]{2,}:[0-9]{2,}/
/\d\d:\d\d:\d\d/
/[0-9]+:[0-9]+:[0-9]+/
/::/
Follow AI Arif for More
Check previous posts for the First Part.