JavaScript Arrays Probably Don't Work How You Expect

preview_player
Показать описание
JavaScript arrays are a bit trickier than you might think. We can manipulate the length of the array in all kinds of different ways!

Prepping for your frontend interviews? Use code "conner" for a discount on my product FrontendExpert:

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

They're not arrays, as arrays are fixed length.
But they're not ArrayLists either, they're pretty much hashmaps in disguise, so they're not guaranteed to be contiguous memory.
Even if they were contiguous memory, they don't hold the values, but references to the values which are sparse throughout memory, so there's a performance hit due to cache misses either way.

leonss
Автор

I always liked how free and flexible javascript was to be honest

big_bits
Автор

the first code language i learned was js, so this just feels normal to me

camerobaird
Автор

These are totally logical, but I wouldn't use it in production code. Especially the first one (in niche cases it might be okay, but there are other ways). The second one can be done easily with slice or destructuring.

YourSuizo
Автор

Why would we use this? What’s the point of this

Urbanghxst
Автор

It's kind of bit confusing as arrays are fixed length, so it should be to first set length and then work, it works like List only, I think, I mean not really following array properties.

mihirsawant
Автор

When this makes sense, have I finally transcended? Or have i simply embraced madness?

jefferymuter
Автор

js is a chill guy like that,
you just don’t get it !!

AAA
Автор

From everything i read, im glad I'm starting with Javascript. That way, when i move to something else, anything else, it will be like understanding a childrens book.

Tully
Автор

Well you see if you simply do things no one would ever do, you can get some wacky results! JS is so weird!🙄

Casprizzle
Автор

🫨😱🤯 I know nothing about JS , why do I feel like a junior every time when I watch your videos 😶‍🌫️😶‍🌫️😭

EricEGunes
Автор

for me that’s entirely logical, I don’t like how other languages restrict interaction with arrays. I know, I am also funny irl

francescos
join shbcf.ru