I want to take every element of from the API and show it in different classes. I am getting the result in my Console but not on the page. Please Help me out. Thanks you in Advance:) .
I have used JavaScript with Jquery.
<script>
$.getJSON('https://api.noopschallenge.com/wordbot?count=5', function(data){
console.log(data);
for(let i=0; i<5; i++)
{
var box = document.createElement("div");
box.setAttribute("class", i);
document.body.appendChild(box);
let dat = `${data.words[i]}`;
let a = i.toString();
document.getElementsByClassName(a).innerHTML = dat;
console.log(dat);
}
});
</script>