Looping through an array of objects

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

Download the source code here:
Рекомендации по теме
Комментарии
Автор

this is a unbelievably important skill to have as a front end developer. This can be used to loop over data so you can save to write the same code 100 times or used to pull info out of an API. This video is a gem

alexlytle
Автор

Oh damn, this is one of the most important skills any junior web developer should learn! Thanks a ton for your video!

vovantoanquoc
Автор

I like how you explained everything it's so easy to understand thank you very much.

BallEcomThatthana
Автор

OMG. . . . I was stuck for so long on this ( I'm a newbie wanting to become a Frond-end Developer ) and this video FINALLY helped me I was trying to figure it out myself, but I see it was "simply" a combination of index-targeting + .property. THANK YOU SOOOO VERY MUCH FOR THIS VIDEO BROTHER ( sorry for the caps, but I am so happy right now )❤❤

Arjunvandemataram
Автор

You just saved me from a 40 minute stress session. Thank you! The [i] was not intuitive to me at all

heatherpalmer
Автор

love it, Thank you for kindly sharing!

vermonkeys
Автор

THANK YOU! I was struggling with this for more than half an hour. Phew <3

maddieandreea
Автор

Would you ever use forEach rather than for to do so? It seems like the [i] is pretty important for displaying specific information.

TheMaxZakh
Автор

how to print all object (model) in two different line on single click

sohelnadaf
Автор

how can you loop through objects that have been composed inside other objects of a different class?

jetforceexe
Автор

how do i take this same concept and target an number in an array that is not defined and console log that number to a different array if that number is greater than 200?

tylerjustice
Автор

Hello, I just want to know how to add using the .push() function.

johngeronimo
Автор

I was previously was set this as a technical test for a job, done something and submitted it but I'm still curious to find out how the function should have written.

const newCandidates = [

{ name: "Kerrie", skills: ["JavaScript", "Docker", "Ruby"] },

{ name: "Mario", skills: ["Python", "AWS"] },

{ name: "Jacquline", skills: ["JavaScript", "Azure"] },

{ name: "Kathy", skills: ["JavaScript", "Java"] },

{ name: "Anna", skills: ["JavaScript", "AWS"] },

{ name: "Matt", skills: ["PHP", "AWS"] },

{ name: "Matt", skills: ["PHP", ".Net", "Docker"] },

];

and the function body which was provided is as follows:

function filterCandidateBySkill(candidates, skill) {

// INSERT YOUR LOGIC HERE

return candidates;

}

the task/ purpose of this function was reorder the candidates bringing those with the skills JavaScript to the top and the other below. This is what I produced for the inside function body:

var candidates = newCandidates;

for(i = 0; i < candidates.length; i++) {

for(j = 0; j < candidates[j].skills; j++) {

while (candidates[j].skills === 'JavaScript') {

return candidates[i].name;

}

}

}

Any Ideas?

niroshansathasivam
Автор

how to show data in table object and array through in loop i tried many ways but not didnt so you can help me.

rockyunited
Автор

how do u write it on website with DOM instead of document.write

zenpanda-relaxationandmedi
Автор

Thank you for your great explanation - penny finally dropped after watching your video :-). question is there a difference between "make": "Honda" and make: "Honda"?

nickpapadatos
Автор

why do you have to add the .length to cars?

nesehai
Автор

BRU he slapping his keys bit way too hard ! :D

PandaPlays
Автор

can you plz explain how to pull out sets of data from each object like make:Honda, Toyota, ford;
model:civic, Camry, mustang; etc.

rashmikolluru
Автор

What if I don't know the name for the objects? You used "make", "year" and "model". What if I am checking a NoSQL document through an API, and idk what I am going to get next? Is there a way to loop through it?

heloisaangeli