Noob question about runtime and DOM stuff #597
Replies: 0 comments 1 reply
-
document is a property of host object window which is a global object of a browser. The So if you try to access I hope this answers your question! |
Beta Was this translation helpful? Give feedback.
-
When running
.appendChild
on the body tag, we usedocument.body.appendChild(foo)
. (Just pretend someone actually has a variable namedfoo
in their JavaScript, ha ha.) So, according to my puny brain, that syntax should work for any element:document.bar.appendChild(foo)
. So how come that causes a runtime error, whilebar.appendChild(foo)
doesn't?Beta Was this translation helpful? Give feedback.
All reactions