Skip to content
Y
yTube.SITE v8.0.4
media / worlds / tools / internet oddities
YouTube / video information

This JavaScript Mistake Breaks Real Apps ๐Ÿ˜ฑ JS Quiz #2

Video information, playback and saved actions.

This JavaScript Mistake Breaks Real Apps ๐Ÿ˜ฑ JS Quiz #2

Description: let a = [1, 2, 3];
let b = a;
b.push(4);
console.log(a); // ?

Most devs get this wrong ๐Ÿ‘€

โŒ b = a doesn't copy the array. It gives the same array a second name.
๐Ÿ” Change b โ†’ a changes too.
โœ… Real copy: let b = [...a];

๐Ÿ“Œ JS Quiz #1 answer: true + tr ...ย Read more
ย ย ย ย ย ย 
Videos related to "This JavaScript Mistake Breaks Real Apps ๐Ÿ˜ฑ JS Quiz #2"

Related videos are temporarily unavailable.

Try again, or come back later.