CHALLENGE
function* numberGenerator() {
yield 1;
yield 2;
yield 3;
}
const gen = numberGenerator();
console.log(gen.next().value);
console.log(gen.next().value);
console.log(gen.next().value);
console.log(gen.next().value);
π11β€2π₯1
What is the output?
Anonymous Quiz
19%
1, 2, 3, 3
9%
1, 2, undefined, undefined
61%
1, 2, 3, undefined
11%
1, 2, 3, 4
π5π€3
Now that you can use the ES modules (almost) everywhere, itβs worth understanding how to package them up for use with npm. Axel digs into everything you need to know and shares some useful tools too.
Dr. Axel Rauschmayer
Please open Telegram to view this post
VIEW IN TELEGRAM
π4β€3π₯1
CHALLENGE
const symbol1 = Symbol('symbol');
const symbol2 = Symbol('symbol');
const obj = {};
obj[symbol1] = 'value1';
obj[symbol2] = 'value2';
console.log(obj[symbol1]);
π4
π8β€3π₯2
CHALLENGE
function outerFunction() {
let x = 10;
function innerFunction() {
x += 5;
console.log(x);
}
return innerFunction;
}
const closureFunc = outerFunction();
closureFunc();
closureFunc();
π€12π10
π10π€9π€£4β€2
Please open Telegram to view this post
VIEW IN TELEGRAM
π€£89π3π€©3
CHALLENGE
const promise = new Promise((resolve, reject) => {
reject('Error occurred');
});
promise
.then(() => {
console.log('Promise resolved!');
})
.catch(error => {
console.log(error);
})
.then(() => {
console.log('Process completed');
});
π5π₯3
What is the output?
Anonymous Quiz
22%
Error occurred -> Promise resolved! -> Process completed
46%
Error occurred -> Process completed
18%
Promise resolved! -> Error occurred -> Process completed
14%
Promise resolved! -> Process completed
π15π€4β€3π₯2
Lea Verou is a developer whoβs easy to admire because whenever she sets out to solve a problem, the results are always fully formed with no cut corners. So it goes with this βexhaustively testedβ JS library for observing changes to CSS properties which deftly handles lots of browser quirks. See the project homepage for more. (TIL thereβs a .style TLD!)
Lea Verou
Please open Telegram to view this post
VIEW IN TELEGRAM
π5π€4β€2
CHALLENGE
let weakmap = new WeakMap();
let obj1 = {};
let obj2 = {};
weakmap.set(obj1, 'value1');
weakmap.set(obj2, 'value2');
obj1 = null;
console.log(weakmap.has(obj1));
β€8π1
π₯10π€9π€£6π5
Itβs been a few years since we covered this project and itβs come along a lot. Itβs a library for building PEG-based parsers you can use in interpreter, compilers, analysis tools, etc. and you can even play with its grammar online.
Warth, Dubroy, et al.
Please open Telegram to view this post
VIEW IN TELEGRAM
β€3π3π€1
CHALLENGE
function Person(name, age) {
this.name = name;
this.age = age;
}
Person.prototype.getDetails = function() {
return this.name + ' is ' + this.age + ' years old.';
};
const john = new Person('John', 25);
console.log(john.getDetails());
π11β€1
What is the output?
Anonymous Quiz
12%
Error: Person is not a constructor.
78%
John is 25 years old.
8%
undefined is undefined years old.
2%
null is null years old.
β€17π€£9π5π€1
Monaspace is a fantastic set of monospaced fonts from GitHub targeted at coding use cases. Its new v1.2 release ups the ante by including Nerd Fonts support and symbols, new box drawing glyphs, characters, character variants, ligatures, and more.
GitHub
Please open Telegram to view this post
VIEW IN TELEGRAM
π10β€2π₯1π€£1
CHALLENGE
const obj1 = { a: 1, b: 2 };
const obj2 = { b: 3, c: 4 };
const mergedObj = { ...obj1, ...obj2 };
console.log(mergedObj);
π10
What is the output?
Anonymous Quiz
15%
{ a: 1, b: 2, c: 4 }
9%
{ a: 1, b: 2, c: 3 }
69%
{ a: 1, b: 3, c: 4 }
7%
{ a: 1, c: 4 }
π₯16π11π€£8β€5π€©1