Message from JavaScript discussions

March 2019

— Works

— 

const person = [ { name: 'Thomas' } ];
const div = document.createElement('div');
div.textContent = 'Name: ' + person[0].name;
document.body.appendChild(div);

— Here can we give id to div tag?

— Yes

— Can you tell me

— div.setAttribute('id', 'my-div');

— Ok

— Thanks

— <div id=

— Where? Like which line

— Where you want

— The attributes to wrok