Hey!
I have the following problemin this challenge
My code is returning Your code should store the data in the html variable
message but the code is doing that! Or there’s some mistake?
<script>
document.addEventListener('DOMContentLoaded',function(){
document.getElementById('getMessage').onclick=function(){
req=new XMLHttpRequest();
req.open("GET",'/json/cats.json',true);
req.send();
req.onload=function(){
json=JSON.parse(req.responseText);
let html = "<div class='val'>";
// Add your code below this line
json.forEach(function(val){
var kk = Object.keys(val);
kk.forEach(function(k){
html=html+"<strong>"+k+"</strong>: "+val[k]+"<br>";
});
html=html+"<br/>";
});
html=html+"</div>";
// Add your code above this line
document.getElementsByClassName('message')[0].innerHTML=html;
};
};
});
</script>