</div>
</div>
<div class="grid--cell mb0 mt4">
<a href="/questions/34070739/how-to-stop-google-chrome-from-restructuring-long-arrays" dir="ltr">How to stop Google Chrome from restructuring long arrays?</a>
<span class="question-originals-answer-count">
(4 answers)
</span>
</div>
<div class="grid--cell mb0 mt8">Closed <span title="2018-02-28 20:18:46Z" class="relativetime">2 years ago</span>.</div>
</div>
</aside>
Working with some data from a JSON/Array from a known video game. I'm close to creating a new array with ONLY the localized name, but can't quite get it right. What am I missing:
const endpoint = './heroes-org.json'
let heroes = []
let renamed = []
fetch(endpoint)
.then(text => text.json())
.then(data => heroes.push(...data.result.heroes))
.then(() => {
for(i = 0; i < heroes.length; i++){
// renamed += heroes[i].localized_name
//heroes.map(function){
//}
setTimeout(function(){
console.log(renamed)
}, 2000)
}})
The map function was an idea to get rid of the unnecessary keys of each array element.
Also, if I just console log heroes
from within the chrome console shows me this:
Doesn't seem quite right. Why is my array separated into 0-99 etc.?
I ultimately want to end up with just 1 array containing all the 115 heroes' names.
</div>