JavaScript
31.9K subscribers
1.01K photos
9 videos
33 files
693 links
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
Download Telegram
πŸ€” How and Why to Build 'Copy Code' Buttons

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
πŸ‘8❀2πŸ”₯2
CHALLENGE

let person = {
name: 'Alice',
age: 30,
valueOf: function() {
return this.age;
}
};

let result = person + 10;
console.log(result);
πŸ‘10❀4πŸ”₯1πŸ€”1
What is the output?
Anonymous Quiz
35%
[object Object]10
20%
undefined
8%
30
38%
40
🀣32πŸ€”23πŸ‘11❀3
3🀣30❀22πŸ‘7πŸ”₯5πŸ€”4
About the post above ☝️ πŸ˜‚
Please open Telegram to view this post
VIEW IN TELEGRAM
1🀣39πŸ‘8πŸ”₯6❀2
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);
πŸ‘13❀2🀣1
What is the output?
Anonymous Quiz
16%
30
12%
29
11%
9
61%
20
πŸ”₯25πŸ‘8πŸ€”8❀2🀣1
CHALLENGE

const sym1 = Symbol('description');
const sym2 = Symbol('description');

const obj = {
[sym1]: 'value1',
[sym2]: 'value2'
};

console.log(obj[sym1]);
πŸ‘8πŸ”₯3❀1
🀣16πŸ‘9πŸ€”4❀1
πŸ‘ Heat.js: A Heat Map Visualization Library

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
πŸ‘11πŸ”₯5❀3
CHALLENGE

function trickyScope() {
var x = 10;
if (true) {
let x = 5;
console.log(x);
}
console.log(x);
}

trickyScope();
πŸ”₯9❀4
What is the output?
Anonymous Quiz
61%
5 10
16%
5 5
9%
10 10
14%
10 5
πŸ”₯10πŸ€”7πŸ‘5🀣5❀3
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘6❀3πŸ”₯3
CHALLENGE

function trickyScope() {
var a = 10;
let b = 20;
const c = 30;

if (true) {
var a = 40;
let b = 50;
const c = 60;
console.log(a, b, c);
}

console.log(a, b, c);
}

trickyScope();
πŸ‘18🀣8❀6πŸ€”2
❀19πŸ‘11πŸ”₯6
Please open Telegram to view this post
VIEW IN TELEGRAM
❀6πŸ‘3πŸ”₯2
CHALLENGE

function trickyFunction(num) {  
let result = 0;
for (let i = 0; i < num; i++) {
result += i;
if (i % 2 === 0) {
result *= 2;
} else {
result -= 1;
}
}
return result;
}
console.log(trickyFunction(4));
πŸ‘7❀2πŸ”₯1
What is the output?
Anonymous Quiz
19%
12
20%
10
25%
8
36%
6
πŸ€”30πŸ‘16❀2πŸ”₯2
✌️ Do Lake Names Reflect Their Properties?

I know this sounds like a geographical piece, but this developer’s curiosity led to a fun blend of JavaScript and the always useful Overpass Turbo mapping tool.

Ivan Ludvig
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘5❀4πŸ”₯1