console.log('Start');
setTimeout(() => console.log('Timeout'), 0);
Promise.resolve().then(() => console.log('Promise'));
console.log('End');
Please open Telegram to view this post
VIEW IN TELEGRAM
What is the output?
Anonymous Quiz
14%
Start, Promise, Timeout, End
21%
Start, Timeout, Promise, End
57%
Start, End, Promise, Timeout
8%
Start, Promise, Timeout, End
π18π€5 4β€1
Run Linux, numerous older versions of Windows, BSD, MS-DOS, and other systems right in the browser (and quickly, too). Not a new project, but Iβm always impressed how itβs constantly getting updates. GitHub repo.
FABIAN HEMMER
Please open Telegram to view this post
VIEW IN TELEGRAM
function Car(make) {
this.make = make;
}
function Truck(make) {
this.make = make;
}
const car = new Car('Toyota');
const truck = new Truck('Toyota');
console.log(car.__proto__ === truck.__proto__);
console.log(car.constructor === truck.constructor);
console.log(car instanceof Truck);
console.log(car instanceof Car);
console.log(Truck.prototype.isPrototypeOf(car));
console.log(Car.prototype.isPrototypeOf(truck));
Please open Telegram to view this post
VIEW IN TELEGRAM
β€10π4
What is the output?
Anonymous Quiz
32%
true, false, false, true, false, false
25%
false, false, false, false, false, false
20%
false, false, false, true, true, false
24%
false, false, false, true, false, false
Please open Telegram to view this post
VIEW IN TELEGRAM
π€£97π10 4β€1
function Animal() {
this.type = 'animal';
}
function Dog() {
this.name = 'dog';
}
Dog.prototype = new Animal();
const rover = new Dog();
const spot = new Dog();
console.log(rover instanceof Dog);
console.log(rover instanceof Animal);
console.log(rover instanceof Object);
console.log(rover === spot);
console.log(rover.constructor === Dog);
console.log(rover.constructor === Animal);
Please open Telegram to view this post
VIEW IN TELEGRAM
β€8π2
What is the output?
Anonymous Quiz
30%
true, true, true, false, true, false
25%
true, true, true, false, false, false
26%
true, true, true, true, true, false
19%
true, true, true, false, false, true
π11π€10π€©3 2β€1
Itβs never been the most popular of the frameworks, but Derby has lived through most of Nodeβs history and remains a viable option for building realtime, collaborative apps in particular. GitHub repo.
NATE SMITH ET AL.
Please open Telegram to view this post
VIEW IN TELEGRAM
π6 4β€2π€£1
function Animal() {}
function Dog() {}
Dog.prototype = Object.create(Animal.prototype);
const rover = new Dog();
console.log(rover.constructor === Animal);
Please open Telegram to view this post
VIEW IN TELEGRAM
β€6
β€10π5π€©2π€1
In an ideal world, the latest version of Node would slot well into every project, but in reality we often need to switch versions, and a variety of tools are available to make it simple. NVM is perhaps the best known, but maybe N, FNM, Volta, or even pnpm could suit you better?
PAVEL ROMANOV
Please open Telegram to view this post
VIEW IN TELEGRAM
β€7π3π€©2 2
function Person(name) {
this.name = name;
}
Person.prototype.sayName = function() {
console.log('My name is ' + this.name);
};
const john = new Person('John');
console.log(john.sayName === Person.prototype.sayName);
Please open Telegram to view this post
VIEW IN TELEGRAM
β€7π1
β€15π€7π4 4
Varik Matevosyan
Software Engineer (Lantern, YC W24)
Please open Telegram to view this post
VIEW IN TELEGRAM
function Shape() {}
function Circle(radius) {}
Circle.prototype = Object.create(Shape.prototype);
const shape = new Shape();
console.log(shape instanceof Circle);
Please open Telegram to view this post
VIEW IN TELEGRAM
π4β€3
π€15π€£6 6β€2π2
const promise = new Promise((resolve, reject) => {
setTimeout(() => reject(new Error('Error')), 1000);
});
promise
.then(result => console.log(result))
.then(result => console.log(result))
.catch(error => console.error(error.message))
.finally(() => console.log('Finally'));
Please open Telegram to view this post
VIEW IN TELEGRAM
π2
What is the output?
Anonymous Quiz
41%
Error: Error, Finally
13%
Error: Error
31%
Error: Error, undefined, Finally
15%
Finally
π€36π10