JSFiddle - React, Tailwind, and code Playground

by nevkatz

HTML

<ul id="list">

</ul>

JavaScript

let str =	"You are on your way!|Ask questions like “What do you think?” |Encourage children to talk. |Introduce new materials and invite specific children to use them with you and choose to use them without you. ";


const arr = str.split('|');
    
console.log(arr.length);
const innerHTML = arr.map(x => `<li>${x.trim()}</li>`).join('');

let list = document.querySelector('#list');

list.innerHTML = innerHTML;
console.log(arr);
/*
for (let item of arr) {
   
   let li = document.createElement('li');
   li.innerHTML = item;
   list.appendChild(li);
}*/