Javascript (Not defined error) [closed]

I’m not too sure what line of code is meant to have the error in reality – as the line highlighted https://i.stack.imgur.com/NDzdI.jpg doesn’t seem to be the problem. Here’s your code again:

var logo = document.createElement("img");
logo.setAttribute("src", "Images/logo_js.jpg");
logo.setAttribute("width", "175");
logo.setAttribute("height", "110");
logo.setAttribute("alt", "logo de JavaScript");
document.header.appendChild(logo)

The problem line is the last line. It should be

document.head.appendChild(logo);

There may be other issues within your app – but that’s the only problem line I can see in your code. It’s also easier if you just output your code here on Stackoverflow than reference it within an image.

Browse More Popular Posts

Leave a Comment