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
CHALLENGE
let weakmap = new WeakMap();
let obj1 = {};
let obj2 = {};
weakmap.set(obj1, 'value1');
weakmap.set(obj2, 'value2');
obj1 = null;
console.log(weakmap.has(obj1));
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
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());
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.
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
CHALLENGE
const obj1 = { a: 1, b: 2 };
const obj2 = { b: 3, c: 4 };
const mergedObj = { ...obj1, ...obj2 };
console.log(mergedObj);
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 }
A commonly encountered way to give readers easier access to source shared on the Web. David Bushell has an interesting followup reflecting on his own experiences implementing the same feature.
Salma Alam-Naylor
Please open Telegram to view this post
VIEW IN TELEGRAM
CHALLENGE
let person = {
name: 'Alice',
age: 30,
valueOf: function() {
return this.age;
}
};
let result = person + 10;
console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
CHALLENGE
const numbers = [1, 2, 3, 4, 5];
const result = numbers
.filter(num => num % 2 === 0)
.map(num => num * num)
.reduce((acc, num) => acc + num, 0);
console.log(result);
CHALLENGE
const sym1 = Symbol('description');
const sym2 = Symbol('description');
const obj = {
[sym1]: 'value1',
[sym2]: 'value2'
};
console.log(obj[sym1]);
Think the GitHub contributions heat map. No dependencies, small, responsive, and theme-able. There’s a live demo or its GitHub repo.
William Troup
Please open Telegram to view this post
VIEW IN TELEGRAM
CHALLENGE
function trickyScope() {
var x = 10;
if (true) {
let x = 5;
console.log(x);
}
console.log(x);
}
trickyScope();