[Solved] I want to loop through an array but I don’t want to use for
[ad_1] You can use Array.prototype.map for this. In your case: suspects.map((name) => { let suspectObj= CreateSuspectObjects(name); suspectsList.push(suspectObj); }); If you need the index in the future you can also do: suspects.map((name, idx) => { let suspectObj= CreateSuspectObjects(name); suspectsList.push(suspectObj); }); 4 [ad_2] solved I want to loop through an array but I don’t want to use … Read more