You Should Know How To Do This Before Applying For Jobs

preview_player
Показать описание

Array methods are generally easy to work with, but creating your own array methods from scratch is a bit trickier. In this video I will be going over how to recreate all the important array methods which is great practice for interviews.

📚 Materials/References:

🌎 Find Me Here:

⏱️ Timestamps:

00:00 - Introduction
00:43 - Downloadable Test File
01:40 - forEach
03:17 - map
03:55 - filter
04:55 - reduce
08:14 - some
09:00 - every
09:20 - flat
13:07 - find

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

I got hired. I just wanted to say thank you for everything. The way you explain things in programming is just the next level. I am a Ukrainian, I've been here in the US for a couple of months and it was tough to get a first junior developer job especially when you have no experience. I passed 2 interviews and I got notified that they are ready to take me as a junior front-end developer. I am going to buy your react and other courses as the way to repay you for everything that you have done for me and improve my knowledge even more. I really mean it. Hopefully, someday I can shake your hand and say thank you to you in person. Take care, Kyle!

senselessexistence
Автор

These methods have made working with arrays so much easier. And you just reminded me that Javascript functions now have default parameters. I actually forgot about that - Javascript's all grown up now! (I was a C++ programmer in a previous life when JS was still in diapers. I'm still absorbing its awesome new powers.) Nice cheat sheet, thanks!

bobdinitto
Автор

Not just this video, I enjoy all of your videos.
Although I'm senior react dev and software engineer, I always find in your videos a lot to learn. Thanks

samerallahham
Автор

I have been interviewing FE devs for over 5 years. I ask about array methods in almost all my interviews. The most important thing I am looking for is that you know what the method does, if the method mutates the array (e.g sort) and a use case for the method. Recently, I also started asking about for...of loops to check for understanding of iterators & generators. (for example using generators you could significantly improve some of the performance of the methods implemented in this video because you would be avoiding spread operators and recreating arrays)

dogoku
Автор

i actually had an interview this morning and I was asked questions about the array API. couldn't answer some of them. you should've posted this yesterday, Damn it!

pancho
Автор

One of the best programming videos/tutorials I’ve seen! Thanks

LuisReyes-zsuk
Автор

I did this for the plain objects for looping their properties which that is also a pain in the ass 😁

biliyonnet
Автор

To continue the job interview: Kyle, what is the big O notation for each of these methods. In your answer please include creating the structure being parsed by your method. For extra credit please play the binary search on your guitar.

ectopicortex
Автор

One minor suggestion at 11:35
I would rather create a new recursive function that takes the newArray as argument.
something like: flatRecursive(array, depth, newArray)
So you don't need to spread the whole array which might be inefficient.

iammakimadog
Автор

The reduce function really should have the check if the initial Value is null before the loop begins.
With the way it's coded in the video, this check is being run for every single method in the array.

For small arrays, even decently sized ones, this is no problem, there's basically no time difference.
However with quite large arrays, this check will slow the function down quite significantly.

I just tested this myself with an array size of filled with their indices, and a function that simply adds them together.

The code in the video took 193ms whilst taking the check out of the loop reduced that to 51ms

TheSlayerDiary
Автор

I knew none of that and got a job.

...obviously I knew some but my boss is understanding enough that nobody is perfect and we just forget stuff every single day...

shapelessed
Автор

Please do an intensive video on testing. (Like this one)

ofeenee
Автор

The reduce it's wrong not only for the reasons other commenters pointed out but also because if initial value is null it calls the callback with the first element of the array as the accumulated value but passing the current value as the second element of the array.

Ironically this show how difficult and how important is to write good tests.

paoloricciuti
Автор

Thanks man you just helped me crack my UI developer job interview.
Thank you so much 😊😍🤩😇

harsh
Автор

This is a fantastic exercise, and understanding the implementations of those methods serves as a reminder of the code they abstract.

theresamclaird
Автор

in the reduce function, shouldn't you check for initialValue == null before the for loop instead of checking it in every loop? something in the likes of:

function reduce(array, cb, initialValue) {
let currentValue = initialValue
let index = 0

if (currentValue === null) {
currentValue = array[index++]
}

for (; index < array.length; index++) {
currentValue = cb(currentValue, array[index], index, array)
}

return currentValue
}

// test
arr = [1, 2, 3, 4]

console.log(reduce(arr, (curr, el) => {return curr + el})) // 10
console.log(reduce(arr, (curr, el) => {return curr+ el}, 10)) // 20

mateuscortianoschwarz
Автор

@Kyle, do u have plan to simplify web3 development?

geforcesong
Автор

I learned these last week after a guy in my discord said he wouldn’t hire me if I didn’t know them and wow, they sure do make working with arrays easier..

Adjust
Автор

As a senior dev, it feels weird to watch these videos 😂

FilipCodes
Автор

As a newbie, this is great practice! Thanks!

spicystephie