Thank you for the response. It's is very helpful. You right, The window object exists only in the browser (client-side). I wanted to show the basic concepts of javascript. The scope of node js it's a little bit different. You can create a global variable by doing global.length (not recommended) - but without it, I think this won't know what length is. if you that in node.js it will work:
Thank you for the response. It's is very helpful. You right, The window object exists only in the browser (client-side). I wanted to show the basic concepts of javascript. The scope of node js it's a little bit different. You can create a
global
variable by doingglobal.length
(not recommended) - but without it, I thinkthis
won't know whatlength
is. if you that in node.js it will work: