Js Ques
Js Ques
of questions can
be increased or decreased, also each question can be deep dived for better clarity
showHobbies() {
this.hobbies.forEach(function (hobby) {
console.log(`${this.name} likes ${hobby}`);
});
},
};
person.showHobbies();
4)Hoisting //give some examples to test:
a)
a = 5;
console.log(a);
let a;
b)test with changing scenarios like output for below and in case if var b from
function dummy is removed
var b = 4;
function dummy() {
b = 'hello';
console.log(b);
var b;
}
dummy();
console.log(b);
c)
function test(){
setTimeout(()=>{
console.log(x);
console.log(y);
},3000);
var x = 2;
let y = 12;
}
test();
5)combination of closure/higher order function/function currying, something like
below: //tweak it to analyze more in different ways,
Write a function test that would allow you to achieve these results.
let a=true;
setTimeout(()=>{
a=false;
},2000)
while(a){
console.log('Welcome')
}
13)Difference between localstorage, sessionstorage, cookie // tweak the ques based
on their ans like what if browser is closed / a new tab has been opened / a
duplicate tab has been created