What is the output of the following? async function foo() { return 42; } console.log(foo()); JavaScript DeveloperMedium Try Now
What does the following code output? class Animal { constructor(name) { this.name = name; } speak() { return `${this.name} makes a noise.`; } } class Dog extends Animal { speak() { return `${this.name} barks.`; } } const d = new Dog(‘Rex’); console.log(d.speak()); JavaScript DeveloperMedium Try Now
What is the output of the following? const p = new Promise(resolve => resolve(1)); p.then(v => v * 2).then(v => console.log(v)); JavaScript DeveloperMedium Try Now
What does the following code output? console.log(‘a’); setTimeout(() => console.log(‘b’), 0); Promise.resolve().then(() => console.log(‘c’)); console.log(‘d’); JavaScript DeveloperMedium Try Now
What is the difference between call() and apply() when invoking a function? JavaScript DeveloperMedium Try Now
What does the following code produce? function* gen() { yield 1; yield 2; return 3; } const g = gen(); console.log([…g]); JavaScript DeveloperMedium Try Now