Twitter | Search | |
Christian Schaefer May 2
Replying to @stefanjudis @syntaxfm
Noooo, why did nobody ever tell me!?!? The best trick I new so far was to use destructuring to swap places in an array. /cc
Reply Retweet Like
Christian Schaefer May 2
Replying to @stefanjudis
Okay, it's not exactly the same use case but still..👌
Reply Retweet Like
🌳 Emanuel Kluge 🐿 May 2
Replying to @stefanjudis
Be careful when copying non-primitive values though, because the copied items are references to the original one. const foo = [{ a: 'b' }, { c: 'd' }]; foo.copyWithin(0, 1); foo[0].c = 'e'; console.log(foo[1].c); // => "e"
Reply Retweet Like