JavaScript
32K subscribers
1.04K photos
10 videos
33 files
719 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
πŸ˜†
Please open Telegram to view this post
VIEW IN TELEGRAM
🀣71πŸ”₯5πŸ‘2🀩2
CHALLENGE

const array = [1, 2, 3, 4, 5];
const [first, ...rest] = array;

const modified = rest.map((n, i) => i % 2 === 0 ? n * 2 : n);

console.log(first, modified);
❀9πŸ‘4
πŸ‘9
πŸ˜‚
Please open Telegram to view this post
VIEW IN TELEGRAM
🀣108πŸ‘9❀4πŸ”₯1
CHALLENGE

const obj = { a: 1, b: 2 };
const proxy = new Proxy(obj, {
get(target, prop) {
return prop in target ? target[prop] : 0;
}
});

console.log(proxy.a, proxy.b, proxy.c);
❀11πŸ”₯3πŸ‘2
❀6
✌️ How to Annul Promises in JavaScript

You can 'cancel' XHR and fetch requests, but can you cancel regular promises? Currently, no, but Zachary looks into doing the next best thing: telling a promise the game's up, and discarding/ignoring its eventual results.

Zachary Lee
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘7
CHALLENGE

const array = [1, 2, 3];
array[10] = 4;

console.log(array.length);
console.log(array.includes(undefined));
πŸ‘21πŸ€”12❀11🀣6
πŸ“Š Sliderland: A Minimalist Coding Playground

A slider control based visualization you can code with simple formulas. We last linked to this a few years ago, but it’s still a fun way to do some quick, visual JS math experimentation. Tixy.land is along similar lines, but based on a 2D grid.

blinry
Please open Telegram to view this post
VIEW IN TELEGRAM
❀8πŸ‘4πŸ”₯1
CHALLENGE

const obj = {
a: 1,
b() {
return this.a;
}
};

const b = obj.b;
console.log(b.call({ a: 2 }));
πŸ‘20❀5🀩2
What is the output?
Anonymous Quiz
54%
2
20%
1
17%
undefined
9%
Error
πŸ‘2
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ”₯4❀3🀩3
CHALLENGE

const array = [1, 2, 3, 4, 5];
const result = array.some(n => n % 2 === 0) && array.every(n => n < 10);

console.log(result);
πŸ‘5❀4
What is the output?
Anonymous Quiz
53%
true
19%
false
21%
[1, 2, 3, 4, 5]
8%
Error
πŸ”₯9πŸ‘5❀3
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘14❀6πŸ”₯4
CHALLENGE

const obj1 = { a: 1, b: { c: 2 } };
const obj2 = { ...obj1 };

obj1.b.c = 3;

console.log(obj2.b.c);
πŸ‘7❀6
What is the output?
Anonymous Quiz
10%
Error
18%
undefined
50%
3
23%
2
πŸ€”15πŸ‘6🀩2❀1
πŸ˜†
Please open Telegram to view this post
VIEW IN TELEGRAM
🀣104❀4🀩3πŸ”₯1
CHALLENGE

const arr = [1, 2, 3, 4, 5];
const sliced = arr.slice(1, 3);
const spliced = arr.splice(1, 3);

console.log(sliced, spliced, arr);
πŸ‘13
πŸ‘23πŸ”₯9❀3πŸ€”3🀩2