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
I bet many of you are fans of xkcd! For this yearβs April Foolsβ joke, they published βMachineβ, a giant Rube Goldberg machine of sorts (explained here). With a lot of TypeScript up front and Haskell in the back, hereβs how it works at a technical level. (GitHub repo.)
MAX GOODHART
Please open Telegram to view this post
VIEW IN TELEGRAM
β€4π1π€1π€£1
const promise = new Promise((resolve, reject) => {
setTimeout(() => resolve(3), 1000);
});
promise
.then(result => {
console.log(result);
return result * 2;
})
.then(result => {
console.log(result);
return new Promise(resolve => setTimeout(() => resolve(result * 3), 1000));
})
.then(result => {
console.log(result);
});
Please open Telegram to view this post
VIEW IN TELEGRAM
π17π€£6π€©4β€2
π13β€3π€1
A fantastic demonstration of using browser APIs to create more elegant drag and drop experiences that even work across different browser windows or IFRAMEs, with Atlassianβs Pragmatic Drag and Drop library doing the heavy lifting.
ALEX REARDON
Please open Telegram to view this post
VIEW IN TELEGRAM
π11β€3π€©1
const promise = new Promise((resolve, reject) => {
setTimeout(() => reject(new Error('Rejected')), 1000);
});
promise
.then(result => console.log(result))
.catch(error => console.error(error.message))
.then(() => console.log('After catch'))
.then(() => console.log('After then'))
.catch(error => console.error(error.message));
Please open Telegram to view this post
VIEW IN TELEGRAM
π4π€1
What is the output?
Anonymous Quiz
17%
Rejected, After catch
39%
Rejected, After catch, After then
25%
Error: Rejected, After catch, After then
19%
Error: Rejected
π10β€4π€£2 2π€©1
A similar idea to Mermaid but with a different attitude to extensibility as well as no requirement for a headless browser server-side. The intro docs have both visual and code examples.
HIKERPIG
Please open Telegram to view this post
VIEW IN TELEGRAM
What is your salary as an engineer? π΅
Anonymous Poll
36%
0
12%
< 500$
8%
< 1.000$
8%
< 2.000$
9%
< 4.000$
6%
< 8.000$
4%
< 10.000$
2%
< 12.000$
3%
< 15.000$
12%
< 20.000$
π€£51π€15π€©7 7β€5π5
CHALLENGE
function Product(name, price) {
this.name = name;
this.price = price;
}
Product.prototype.discount = function(discount) {
this.price -= discount;
};
const product = new Product('Phone', 500);
product.discount(50);
console.log(product.price);
π8β€2π₯1
π12π€£10 4π€1π€©1
We hope you're enjoying the content on our channel!
To continue delivering more exciting content, features, and exclusive stories, we're kindly asking telegram premium users to help us take things to the next level.
By boosting our channel, you'll directly contribute to enhancing your viewing experience and supporting the growth of our community.
Thank you for being a part of our journey. π
P.S. Each Premium user can boost 4 times.
https://t.iss.one/javascript?boost
Please open Telegram to view this post
VIEW IN TELEGRAM
Telegram
JavaScript
Boost this channel to help it unlock additional features.
π14 6β€2
CHALLENGE
function Animal() {}
function Dog() {}
Dog.prototype = Object.create(Animal.prototype);
const rover = new Dog();
console.log(rover.constructor === Animal);
console.log(rover.constructor === Dog);
console.log(Dog.prototype.isPrototypeOf(rover));
console.log(Animal.prototype.isPrototypeOf(rover));
π3β€2π₯2π€1
What is the output?
Anonymous Quiz
29%
true, false, true, true
27%
false, false, true, true
24%
false, true, false, true
20%
true, true, true, false
π7 3β€2
Please open Telegram to view this post
VIEW IN TELEGRAM
π€£100π11 7β€4π€2
CHALLENGE
function Shape() {}
function Circle(radius) {
this.radius = radius;
}
Circle.prototype = Object.create(Shape.prototype);
Circle.prototype.constructor = Circle;
const shape = new Shape();
const circle = new Circle(5);
console.log(circle instanceof Circle);
console.log(circle instanceof Shape);
console.log(shape instanceof Circle);
console.log(shape instanceof Shape);
β€9π3π₯1
What is the output?
Anonymous Quiz
42%
true, true, false, true
21%
false, false, true, true
25%
true, false, true, false
12%
true, true, true, true
π8β€4π€©4π€£3π₯1
ArmenVardanyan
Author of "Modern Angular"
Google DevExpert for Angular
Please open Telegram to view this post
VIEW IN TELEGRAM
β€3π3π₯2π€£2π€1π€©1
CHALLENGE
function Animal() {}
function Dog() {}
Dog.prototype = Object.create(Animal.prototype);
const rover = new Dog();
console.log(rover.hasOwnProperty('constructor'));
π5β€2π₯2π€£2
π€7π€£4β€3π3π₯1