+ 4
it's because node.js doesn't run in browser like js. there is no document object to call methods from.
+ 4
Yubraj
Because document is not an object of Node JS instead use console.log
+ 2
document is an object referring to the html side of code, node js doesn't rely on a browser therefore document is not defined and any if it's methods would not work