Array containing N Numbers in JavaScript // Clean Code

preview_player
Показать описание
Create an array of n numbers in JavaScript. This can also be used as a simple Interview Question - But here we look beyond the basics to determine which method should you use 🌹

🏷 #basarat #CleanCode #TypeScript #JavaScript #Tutorial

👇 ❤️ Subscribe for MOORE ❤️ 👇

🌹 Support 🌹

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

If you're a junior to mid dev right now and you are subscribed to this channel, you will have an advantage

beriu
Автор

Iterates option reminds me: "The more your code looks like C the more it will perform like C"

xdrap
Автор

Just letting you know, in case it wasn't intended, you have a typo in the thumbnail

ProdigykX
Автор

Great one mate, but how to read this benchmark results 😅

kishoreandra
Автор

Cool tips. But if you initialise your array at the beginning for the Iterate version with new and use array[I]=i instead of push then it is almost 5 times faster. 3, 914 ops/s vs 17, 948 ops/s for me.

MajoCQ
Автор

I hate this kind of stuff because it shows of devs trying to flex to much syntactic sugar approaches VS basic simple logic that would actually solve the problem the fastest. This is also probably a great sign your about to hire a Dev that will make it their life's missions to make 1 line JS statements everywhere leading to a nightmare of maintainability by a team. There is a simple expression I learned long ago "complexity doesn't scale well" remember the that and you will go far.

cas
Автор

The extension says `GOD Demo file` ? Which one extension would it be? Please: thanks in advance.

alvarobyrne
Автор

how about the using generator to beat the slowest one from other side. 😉
function* range(n) {
start = 0
while (start < n) {
yield start;
start += 1;
}
}

marslogics
visit shbcf.ru