How do I render arrays of objects that this API returns. ..please help

/*for (let i = 0; i < response.length; i++) {
  //let  myJSON = JSON.stringify(obj);

document.getElementById(‘container-1’).innerHTML = =>

UserID: ${}

Title: ${user.title}

Body: ${user.body}


console.error(“something went wrong with retrieving people”);

@RandellDawson Have a look .please

what’s the issue?
I tried executing your code and I get an array of objects

@ilenia I edit my post. I’m trying to render all of the posts that this API returns using json.stringfy() ,map() function.

what have you tried? the code is still the same

@ilenia I edited my code. please check.

this is your function, do you get any error?
what result are you getting, what is the wanted result instead?

@ilenia I just wanna render my array of objects. the code you mentioned shows an error for not having function decleration.

what does the error say exactly?


So what happens if you give the function at line 43 a name? Because if you’re getting that error, then I think it means you’ve just literally put

function (obj) {

Into your code, not in as a callback, just straight into the code

Edit: you’re missing a closing } on that callback function

Edit edit: I’m completely confused now. Have you edited the code you’ve posted several times? because it doesn’t quite make sense unless the replies were about code that isn’t now visible

Did you look in the console? With your current code, it is telling you that userID is not defined. You want to map over obj in the callback.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.