forEach Array Method | JavaScript Tutorial

forEach Array Method | JavaScript Tutorial

Florin Pop

4 года назад

217,787 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Yakuzanis
Yakuzanis - 12.09.2023 15:33

thank you for this great explanation <3

Ответить
Matt Smith
Matt Smith - 11.08.2023 06:23

I've been hearing a lot of.... distain for the "forEach" method. Especially in the context of asynchronous code.
Not an expert, but be careful using this method.

Ответить
Cristina Soare
Cristina Soare - 29.04.2023 16:24

Hi Florin, can you do a similar playlist of videos as you have for array methods but for strings? Thanks!

Ответить
Lucas Damasceno
Lucas Damasceno - 13.03.2023 14:52

thanksss

Ответить
Frank Edogun
Frank Edogun - 09.02.2023 00:18

Thanks a lot. I get it now. I’m currently using ZTM

Ответить
Zoïr Radjabov
Zoïr Radjabov - 21.01.2023 17:21

Nice explanation! It is is exactly that I was after🤓

Ответить
moessyd
moessyd - 30.11.2022 11:57

.

Ответить
Skura
Skura - 04.11.2022 23:10

Thanks!

Ответить
Anya Shurubey
Anya Shurubey - 12.10.2022 21:32

Thank you so much!!!

Ответить
Mariana Rodriguez
Mariana Rodriguez - 07.10.2022 23:44

your code could be done in almost only two lines, but thank you so much.

Ответить
Marlon Martins
Marlon Martins - 25.08.2022 15:28

I found an easier way, const countries = ['Argentina', 'Brazil', 'Argentina', 'Portugal', 'Brazil'];

// Keep track count of every country
let count = {};


countries.forEach((country) => {
count[country] = (count[country] || 0) + 1;
})

console.log(count);

Ответить
RSN
RSN - 21.07.2022 11:31

thank you very much for this very clear explanation! it really helped me a lot!!!

Ответить
andres viveros
andres viveros - 31.05.2022 01:09

if foreach doesnt return anything how can it be used? Thanks

Ответить
Wei Lin
Wei Lin - 25.05.2022 05:44

Hi Florin, thanks for your great tutorial. In the end of the video, inside the if parentheses, it's only count[item], normally inside if parentheses would be conditions with comparison operators, so I'm not quite understand what does if (count[item]) stands for, could you explain more for this ?

Ответить
Rahul Rai
Rahul Rai - 17.05.2022 19:59

can you tell me how is your output is showing in the terminal

Ответить
Jack
Jack - 15.05.2022 04:52

got yo million yet yo

Ответить
hazim mohammed
hazim mohammed - 14.05.2022 02:11

Hi plss reply me i need help

Ответить
tom santos
tom santos - 23.04.2022 04:30

very good content theacher !!! thaks

Ответить
Ande Joel
Ande Joel - 22.04.2022 01:02

let sum = 0;
number.forEach(function(value){
sum += value;
})

console.log(sum);


this would generate the same answer, is there any thing I should know about using it?

Ответить
Bernardus
Bernardus - 10.04.2022 20:36

Everywhere I read about forEach it says that the method does not return anything but in this tutorial the sum was clearly returned. WUT??? Am I missing something here?

Ответить
Arya Adinul Fadlan
Arya Adinul Fadlan - 05.01.2022 07:21

love you florin

Ответить
Nedum
Nedum - 04.01.2022 21:01

Thanks for the Tutorial.

But please can I send you forEach code I wrote that won't work at all? Maybe you can show me what am doing wrong.

Ответить
Sharath s
Sharath s - 17.12.2021 18:33

thanks man

Ответить
Kenny
Kenny - 06.12.2021 04:12

please , what addon i have to install to run JS in VS code?

Ответить
Nagendra Ch
Nagendra Ch - 18.11.2021 07:48

Nice explainer, buy how you using vscode terminal to output those javascript code?

Ответить
Xuân Thành
Xuân Thành - 10.10.2021 11:47

How do you clean the terminal?

Ответить
Favour Akpasi
Favour Akpasi - 22.09.2021 18:40

this was very helpful, i enjoyed every moment of the tutorial and i understand array functions better now. just 1 question how do I display my console log in vs code.

Ответить
Linas Kaškonas
Linas Kaškonas - 12.09.2021 09:24

How to download this coding platform?

Ответить
Levi N
Levi N - 01.09.2021 21:04

Learned some new stuff with the object counter, nice!

Ответить
Sami
Sami - 05.08.2021 11:00

How to get output like him ?

Ответить
JustinxTen4real
JustinxTen4real - 27.07.2021 23:19

Nice break down currently in a boot camp and this will definitely be of use

Ответить
codex
codex - 17.07.2021 01:12

Where are you from?

Ответить
Cai Shang-Hao
Cai Shang-Hao - 10.06.2021 13:23

thanks

Ответить
Qat Add
Qat Add - 05.06.2021 14:23

You Are Amazing Thank You A Lot

Ответить
league ahri
league ahri - 28.05.2021 06:46

thank you rebeccaPurple man

Ответить
مبین عطرزادہ
مبین عطرزادہ - 26.04.2021 20:37

وری گود

Ответить
Fahad Zakir
Fahad Zakir - 25.04.2021 20:41

For anyone else like me who didn't understand the last Object loop:
The last part if (count[item]) is true if the object has a property and then it goes to the condition of incrementing the property value ++.
If it is false then it's assigned that property with the value 1.

Ответить
Achmad Shobari
Achmad Shobari - 07.04.2021 06:47

Thank you Sir, your tutorial is very clear and show that we can use the method in different way, thank you so much Sir

Ответить
Nithish Raina
Nithish Raina - 26.03.2021 19:48

This helped me to build a solution for returning a max char from an array. Thnx for this tutorial and whole playlists.

Ответить
Pixel Bender
Pixel Bender - 14.02.2021 12:08

I personally hate Javascript it's so loosely typed, with no structure in mind Garbage!!

Ответить
web graphics
web graphics - 26.01.2021 10:20

You are the BEST... That's the fact

Ответить
Nosense
Nosense - 22.01.2021 10:41

vip pro

Ответить
Bahia Anis
Bahia Anis - 15.12.2020 23:01

thank you for this tuto , how can i use the terminal like that please

Ответить
Gonzalo Perez Rojas
Gonzalo Perez Rojas - 09.12.2020 17:25

"let count = {}" means that you declare a variable with an undefined value?

Ответить
Thomas
Thomas - 01.11.2020 18:48

Hi, thanks for a great tutorial and I have a small question. How can I get the same result in the terminal - I mean without an unnecessary code (like: $ node "c:\Users\thomas\Desktop\Exercises\script.js"), only pure result, like on your video. Regards, Thomas.

Ответить
Aarón Argotte López
Aarón Argotte López - 14.09.2020 17:24

I am thankful to you. Great video.

Ответить
mrhash tag
mrhash tag - 06.09.2020 17:39

hey pls help me.... i dnt understand the let count={} and how the count[item]++ works ?

Ответить