JavaScript Array Method Exercises 03

preview_player
Показать описание
In this video, you'll get another chance to go through some practice exercises with JavaScript Array Methods.

Jump to any of the exercises:
01:17 Exercise One (02:17 Final Solution)
02:33 Exercise Two (03:07 Final Solution)
03:24 Exercise Three (04:03 Final Solution)
04:44 Exercise Four (05:55 Final Solution)
06:14 Exercise Five (07:23 Final Solution)

In the tutorial, you'll learn about various different array method available in JavaScript by completing some simple exercises on an array of data i'll provide you with.

Don't worry if you get stuck - i've provided example solutions but feel free to post your own if you come up with something different.

#JavaScript #Practice #Exercises Channel Handle @codebubb
Рекомендации по теме
Комментарии
Автор

I really loved the destructuring approach to the excercise where you needed to add user's first and last name to the comments array - it was so cool. Please add more exercises like this to your channel, particularly with a reduce method where you reduce an object to a desired result!

Elator
Автор

Got your own solution to one of the exercises? Post it as a comment below!

codewithbubb
Автор

Thank you so much for these exercises!!!I am learning something !!

GauthamHC
Автор

You rock, man! thanks for these videos!

luisrevilla
Автор

more javascript array method exercises to come and help solve task to my work, Many thanks

sannymiraflor
Автор

Thank you, excellent video, wonderful exercises, give us more of this amazing content!

Elator
Автор

For the exercise 1:

let userID = users.filter(el => el.firstName == 'Madison' && el.lastName == 'Marshall').map(el => el.id)

This gives you the ID of all the 'Madison Marshall' inside an array

GREATS VIDEOS! SO HELPFUL! THANKS!! <3

borisfindell
Автор

Thanks man it was so helpful I hope u post more and more about objects especially

mu.x
Автор

You could also have used the includes method in part 5 inside the filter method.

umernasir
Автор

ex-4
didnt use array method but find it simple this way
for (let c of comments) {
for (let u of users) {
if (c.userId === u.id) {
c.firstName = u.firstName
c.lastName = u.lastName
}
} console.log(c)

}
this is another:
comments.forEach(c => {
users.forEach(u => {
if (c.userId === u.id) {
c.firstName = u.firstName
c.lastName = u.lastName
}
})
console.log(c)
})

ankitadandwatenimkar
Автор

for the exercise 1 i have one more solution .
const madisonuserid =
console.log(madisonuserid);

udaykreddy
Автор

Ex-1) :
it gave the same result but when i filtered with ' user.firstName' only it gave an array has the same ' firstName' which i have pushed
, also u mentioned to some differences bitween filter &find but I still don't get it :/

karimmoawad