Good evening! There is an array arr=[{id:1, title:...}, {id:2, title:...}, {id:3, title:...} ] , I need to output each subsequent id with a new line, i don't use html / css. How can I do it?

    1 answer 1

    Clean code:

     arr.forEach((el) => { el.id // делайте с ни что хотите }); 

    Here is an example of the full version.

     var arr=[{id:1, title:'123123'}, {id:2, title:'123123'}, {id:3, title:'123123'} ] var items = '<ul>' arr.forEach((el) => { items += '<li>' + el.id + '</li>' }); items += '</ul>' document.getElementById('res').innerHTML = items 
     <div id="res"></div> 

    • It will be displayed on canvas, there is no possibility to use HTML. - Artyom Sapsay pm
    • Well, so you start with this. But they started in one thing, now speak about the canvas ... for example with the canvas codepen.io/anon/pen/ddmbRo - Yuri Kopot
    • one
      on the design of the text here read habrahabr.ru/post/140235 - Yuri Kopot