Link to my programming Video Library:
https://courses.LearnCodeOnline.in
Desktop: https://amzn.to/2GZ0C46
Laptop that I use: https://amzn.to/2Goui9Q
Wallpaper: https://imgur.com/a/FYHfk
Facebook: https://www.facebook.com/HiteshChoudharyPage
homepage: http://www.hiteshChoudhary.com
Download LearnCodeOnline.in app from Google play store and Apple App store
Disclaimer:
It doesn’t feel good to have a disclaimer in every video but this is how the world is right now.
All videos are for educational purpose and use them wisely. Any video may have a slight mistake, please take decisions based on your research. This video is not forcing anything on you.
All Amazon links are affiliate links (If any).
Original source
24 responses to “ForEach loop in javascript”
There should be a DS and Algo in JavaScript course on your website.
what are you writing your code on!.
OMG!!! I swear! You are the only one that has been able to SIMPLY explain the .forEach()! THANK YOU!!!!
Which font style do you use ?? Please reply..
Hi.
I have one request can you please do one project by using Javascript.
The videos were not in a symetrical manner ! you have used foreach loop in video no:16, and explaining it in 18
I cant understand the 2nd Assignment…!
what software are you using for the coding?
what will happen if we add third or more argument to the function????
So, if you have 3 ID names of DIVs in array, you can .pop() or .shift() one of them randomly and add to the rest a classes names
var myArray = ['div', 'div2', 'div3'];
var removeLast = myArray.pop();
myArray.forEach(function(divName){
document.getElementByID(divName).classList.add("redFromCSS");
}) //and JS will list them one by one and add forEach that redFromCSS. Amazing… I use that trick to display: none my divs wich i dont use in CSS animations. I put all my divs name in array, then remove that i will use and rest of them in array i cut out by adding css style to wipe that divs. 😁
great explanation thank you
I'm a brown guy as well so don't take offense, but your videos are the only coding ones I can understand because your accent isn't as strong as some of the others on Youtube. I'm definitely subscribing.
Thanks a lot, my king. You are amazing
Great video! Thanks! How do you show the method info in VS code? It popped up when you clicked the forEach method.
Haha! i loved that tiger part :p Btw Amazing videos Sir, thanks. 😀
Your js playlist is slightly out of order. I was watching the for loop video earlier in the series confused as hell about what the forEach loop was
thank you sir!!!…you're gr8!!!…
'tickle guys' .. lol love it
Thank you, very good explanation! I was so confused about FOREACH.
thanks for clarifying forEach! i was having a little hard time using it. im still a little confused on when to use it though
##ASSIGNMENT
let arr=[]
arr.push("Breakfast")
arr.push("Lets write some code")
arr.push("gaming time")
arr.push("Lunch time")
arr.push("write some code again!!")
arr.push("Evening work")
arr.push("have dinner")
arr.push("Bed time")
arr.forEach(function(task,index){
console.log(`Your task ${index+1} is: ${task}`)
})
//forEach loop for entire months
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
months.forEach(function(month, index){
console.log(`month no ${index+1} is ${month}`);
})
//Todo List
const todos = ['Go to Gym', 'Make dinner', 'Sleep for 6 hours']
todos.forEach(function(todo, index){
console.log(`My no ${index+1} task for day is ${todo}`)
})
Great man!
what is callback?