A resourceful newsletter featuring the latest and most important news, articles, books and updates in the world of #javascript π Don't miss our Quizzes!
Let's chat: @nairihar
Post #1831
7.14K
JA @javascript
Showing posts older than #1832 Β· Back to latest
const sym1 = Symbol("id");
const sym2 = Symbol("id");
console.log(sym1 === sym2);

let name = "Alice";
(function() {
let name = "Bob";
console.log(name);
})();
console.log(name);

??= nullish coalescing assignment operator snuck into JavaScript a few years ago via ECMAScript 2021 and has been broadly supported almost everywhere for ages. Trevor shows off how it can tighten up your assignments here.
console.log(typeof typeof 42);
const arr = [1, 2, 3];
const copy = [...arr];
copy.push(4);
console.log(arr);
console.log(copy);

async function test() {
return (await Promise.resolve(0)) || 10;
}
test().then(console.log);

const obj = { value: 10 };
const result = (obj.value += 5) && obj.value;
console.log(result);
