Day 4 – Learning Node JS In 30 Days [Mini series]

Day 4 – Learning Node JS In 30 Days [Mini series]

Window === Global

If you know JavaScript already then you know there is a window object in console

No alt text provided for this image

If you new to JavaScript then just open your console in browser and write window there and you can see the what inside this window object

No alt text provided for this image

When we are on the Browser we can access to the window, but there is no window in the computer. So how we can use that ?

Even after installing the npm, it doesn’t give us to access those window object so how should we do it ?

Well good thing is we can access the window here to, it just changed it’s name. It called global now.

You can go to latest doc of node js by https://nodejs.org/dist/latest-v12.x/docs/api/

No alt text provided for this image

Good thing is you can access the global object which is same as window https://nodejs.org/dist/latest-v12.x/docs/api/globals.html

No alt text provided for this image

Now you can use all the functions like – setInterval, setTimeout etc on app.js

See an example –

No alt text provided for this image

Run the code by `node app.js`

No alt text provided for this image

Did you understand today’s lesson ?

You can comment anytime if you’ve any question!


要查看或添加评论,请登录

Muhammad Ali的更多文章

社区洞察

其他会员也浏览了