N
Try the following const noticias = [{title:"Lorem ipsum", desc:"dolor sit amet...."},{title:"Lorem ipsum", desc:"dolor sit amet...."},{title:"Lorem ipsum", desc:"dolor sit amet...."}]
const articulos = document.getElementsByTagName('article');
for (let i = 0; i < articulos.length; i++) {
articulos[i].innerHTML = "<h3>" + i +
"-" +noticias[i].title+"</h3><p>"+noticias[i].desc+"</p>";
} <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Una web cualquiera</title>
</head>
<body>
<h1 id="titulo">DOM</h1>
<section id="noticias">
<div class="fila">
<article>
<div>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged</div>
<div class="cuerpo">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged</div>
</article>
<article>
<div>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged</div>
<div class="cuerpo">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged</div>
</article>
<article>
<div>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged</div>
<div class="cuerpo">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged</div>
</article>
</div>
</section>
</body>
</html>
We create an array containing objects where we will store information: Title, description; for each <article> We will put this title and that description, the title will have the current number in the position of the array.Solution 2You can use querySelector, then the solution: const noticias = [{title:"Lorem ipsum", desc:"dolor sit amet...."},{title:"Lorem ipsum", desc:"dolor sit amet...."},{title:"Lorem ipsum", desc:"dolor sit amet...."}]
const articulos = document.getElementsByTagName('article');
for (let i = 0; i < articulos.length; i++) {
articulos[i].querySelector("div:first-child").innerHTML = noticias[i].title;
articulos[i].querySelector(".cuerpo").innerHTML = noticias[i].desc
} <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Una web cualquiera</title>
</head>
<body>
<h1 id="titulo">DOM</h1>
<section id="noticias">
<div class="fila">
<article>
<div>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged</div>
<div class="cuerpo">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged</div>
</article>
<article>
<div>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged</div>
<div class="cuerpo">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged</div>
</article>
<article>
<div>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged</div>
<div class="cuerpo">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged</div>
</article>
</div>
</section>
</body>
</html>
Use querySelector to refer to elements with CSS selectors. querySelector will return only the first element with that selector, if you are looking to get all use querySelectorAll, this method will return all the elements to an array.