Why this design does not work?
If you pull out from div user div data - it will work.
But, alas, I can not understand.
And the task in front of me is this - I have an array like this, there are several id in it, I want to put its lastname into the first div, and below in another div, for example, I don’t quite understand how to do this:
John Lastname //div user Skype : 123 //div userExt Dan Qwert //div user? Skype : 456 // div userExt?
Provided that all this will be in the array (I mean several skype and correspondingly, several full names)
window.onload = function() { var person = { id: 1, firstName: "John", lastName: "Doe", age: 46, instagram: 123, skype: "Lamp" }; var user = person['firstName'] + ' ' + person['lastName']; var userExt = person['id'] + ' ' + person['age']; document.getElementById("user").innerHTML = user; document.getElementById("data").innerHTML = userExt; //console.log (data); };
<div id="user"> <div id="data"> </div> </div>
<div><span id=user /><div id=data /></div>
and then by writing down the user you delete the data. - nick_n_a