JavaScript Array Cardio Practice - Day 1 — #JavaScript30 4/30

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

1) .filter(): 1:17
1.1) console.table(): 2:48
2) .map(): 3:55
3) .sort(): 5:16
4) .reduce(): 7:47

**Did this 'cause I come back constantly.

ginnerzapata
Автор

10:08
I've just the started files and the exact same code, but instead of 523, I get 861.


It took me too long to realize that I have more people in my inventors. I'm going to post my comment in case someone else also has more inventors on their list and wonders why their answer is different too.

trophydevice
Автор

Here from the Odin Project. If you're having trouble understanding these, look at the documentation behind each method and really understand what its doing since he doesn't explain it in this video, he just explains what it does and how to use it. I spent 3 hours looking at the documentation for each one to truly understand the behind-the-scenes.

WhichKoreaIsBetter
Автор

For everyone saying he doesn't explain, yes he doesn't. Pause the video, go read about the method/function in the documentation, make stuff with what you have learned from it then start the video again, if you dont do this you wont learn. Also, shout-out to the Odin Project!

samdeleon
Автор

I might be late to the party but I found your videos via the Odin Project. I really like that this gives me a few things to practice as I try and learn how to make JavaScript do what I want it to do.

dbzmm
Автор

congrats if you have made it this far in The Odin Project, a lot of people quit here as it gets harder keep going champ!

Fuckingcoward
Автор

5 years, and this video still invaluable, best content of javascript to learn array methods

josedanielrodriguez
Автор

I seeing you tighten up/reduce the size of the code. That is so freaking helpful.

Sagwafu
Автор

For sorting the people by last name, since they have the last name first, just using people.sort() like that seems to work. It is nice to learn about splitting them up first and separating the specific parts to sort them.

stevenwatkin
Автор

This guy is brilliant, he is very talented but still feels how tough it is for beginners and showcases his coding for all levels. Doesn't give it the big I AM like a lot of programmers do but is humble and helpful to all. Bravo.

fidgetspinner
Автор

instead of returning 1 and -1 you can also do this using,

// ordered list from oldest to youngest
const ordered = inventors.sort((a, b) => a.year - b.year);
console.table(ordered);

// sort by years lived
const oldest = inventors.sort(
(a, b) => b.passed - b.year - (a.passed - a.year)
);
console.table(oldest);

sunjungwoo
Автор

I'm barely keeping up with what's happening in this video but I'm very impressed by it all! I hope I can learn and master all these skills with time and practice!

MVIVN
Автор

Hot tip for young players

people.sort() works for 7. The default behaviour of sort() with no parameters is to sort by ASCII. Because the names Strings already start with the surname, literally all you need to do is use people.sort();

Also, for numerical sort, sort((a, b) => {return a - b}) works. Because if a is bigger, you return a negative number. If equal, you return 0. If smaller, you return a positive number.

This is all in the docs.

CronosXIIII
Автор

These array cardio videos as a FANTASTIC IDEA! What a great concept to improve on the fundamentals! Would love to see more videos likes this!

ThePolaris
Автор

Thanks for the tutorial, i like when you use first function then when you make it arrow function, it makes it easy for beginners to follow and understand.

ruddyriverocabero
Автор

As a beginner, I really hope to be on your level one day. You look like a Dev God from where I am sitting right now lol.

Symuality
Автор

"Bennington, Chester"
[starts crying]

lenaryan
Автор

filter -> takes each element in an array and it applies a conditional statement against it. If this conditional returns true, the element gets pushed to the output array. If the condition returns false, the element does not get pushed to the output array.
map -> used for creating a new array from an existing one, applying a function to each one of the elements of the first array
reduce -> deduct the array into a single solution, can return anything depends on the accumulator you have (either a number, an array or an object...)
sort -> arrange or reverse the original array based on the condition
These are all array method that would not change the original array, but return a new array or solution.
--> console.table is really nice way to show the data in console

cheekianteoh
Автор

with #6 i'm getting errors saying querySelector is 'null.' Im confused as to how you can grab anything from a link that's commented out?

davidborden
Автор

Loved the video.But loved even more what the people from odin project are commenting. They share what is being missed here and what to do about it with respect to the course.Thank you to all these peeps.Thats how a healthy community should be.

Madesh-qfqn
visit shbcf.ru