JavaScript's Most Controversial Array Methods (Part 6)

preview_player
Показать описание
Let's take a look at the destructive array methods in JavaScript: push, pop, shift, unshift, sort, reverse, splice and combineWithin.

👉 What's my theme? Night Wolf [black]
👉 What's that font? Operator Mono

00:00 Introduction
00:33 Why in-place alteration matters
01:18 Push and pop
05:06 Shift and unshift
06:40 Sort
08:23 Reverse
09:05 Splice
10:30 CombineWIthin
11:20 Review
11:54 Outroduction

Thank you for watching this video, click the "SUBSCRIBE" button to stay connected with this channel.

#javascript #arrays
Рекомендации по теме
Комментарии
Автор

Great series! Might want to point out that the built in sort method doesn't work for numbers as expected because it does a string comparison.

SethWeeks
Автор

Awesome content, thanks a lot jack. Eagerly waiting for similar indepth series on js objects and functions.

sagarreddy
Автор

as always, your walkthroughs are far more effective to understand than myself fumbling around and stuck at digesting docs, thank you! gonna rewatch and revise))

yamgemy
Автор

That is agreat series! Could you please do a series like this one for Objects?

wolframzell
Автор

How is that 12 minutes? It felt like 5 minutes with the on point informations you provide us. Great vid Jack!

asadsalehumar
Автор

Superb Series!! Please also make a playlist for functions.

sahnb
Автор

Did not see "unchanging" variation of unshift() before. Interesting way of doing it, but I don't feel like it is very obvious to read and the "value" variable would just be hanging there causing eslint warnings about it not being used. I feel like someone else might misunderstand what's going on and remove the value variable from the destructure and unknowingly break things. But it's a clever and creative way of spread and destructuring.

ZakiWasik
Автор

So simple and elegant. Thanks for showing us the ways!

marcelsdev
Автор

Great series, Thank you very much. I'd love to see how you work these arrays(object) in the DOM and there (un)expected mutations. 👍

foupax
Автор

0:10 some of the destructive methods.
😂😂

ashish_prajapati_tr
Автор

Bit unrelated but I'd love to have a look at your vscode config and plugin list.

darkmift
Автор

More good stuff. I remember using a lot of these back in the day.

shinmessiah
Автор

series was awesome ❤️️ ...state manager knowledge and reduce tricks. .that thing state managers have problem with controversial methods, you get this knowledge from self-observations ..or like how as a developer. I never found a word about that on react documentation.

vinaysharma
Автор

I don't think I had seen copyWithin before 🧐

victorlongon
Автор

In a recent video you explained how spread is inefficient then would you recommend using spread for all these cases?

bhavyajainnd
Автор

Sometimes I don't feel save using the spread operator (...) to clone arrays, because it just clones the first level. I'm afraid that the child's of the original object get mutated, and that affect the copy. But on the other hand, using a deepClone feels like an overkill in terms of performance.

mauriciabad
Автор

Could u plz tell me what plugin u use to compile js while coding? Thank u! always great content!

大盗江南
Автор

Correct me if I am wrong.
4:28 getting last element with the help of slice is slower than
const popped =

EhteshamShahzad
Автор

Hello Jack, I love all these videos, I am learning a lot from them. I do have a question about this video.
I was watching yesterday before bed, and something confused me( haven't been able to test it yet) .

with pop, you removed the 5 from the array, and then added it again with push.

after that, you compared, and said: even though it has been changed, it doesn't look at the change, but the reference.
to add to that argument, you changed a variable 5 to 6 and it compared as false.

Please, correct me if I'm wrong ( because I'm trying to solve it with logic, not JavaScript knowledge... )
even though the array had a changes the content of the array is the same before, and after the changes .
So if you compare [1, 2, 3, 4, 5] with [1, 2, 3, 4, 5], wouldn't it be correct that the compare equals true?

fliplucky
Автор

I used splice once but now it makes sense why it broke.
I did declared a new variable so why is it changing the original 🤣😅

Stoney_Eagle