Introduction to Node.js
This practical course explores the fundamental difference between the Browser and Node.js.
- Learn how to execute Node in the terminal
- Learn what happens when the Window object is used in Node.js
- Learn the differences between the Browser and Node with regards to Web APIs and the DOM
This course is intended for anyone who wants to learn about Node.js.
To get the most out of this course, you should have an interest in Node.js in general.
Introduction to Node.js - Comparing the Browser and Node.js. In this video, I'm going to cover the fundamental difference between the Browser and Node.js. I'm going to begin in the Chrome Console, and I will start by typing 'confirm'. Inside of the confirm, parentheses, I will pass through the following confirmation message, "Would you like to continue?"
I will hit 'Enter' to execute. Now on the screen, the confirmation pop-up has appeared. I'm going to hit 'OK'. So, how would this work using Node? I'm going to transition to the Theia lab environment, and I already have an index.js file created. In the file, I will type the same confirm command along with the same message.
Now to investigate this a little further, I'm going to go back to the Chrome Console, and instead of the console, I will type 'console.log(window)' and hit 'Enter'. And there is the window object which represents the entirety of the browser. Now I'm going to also console.log(this) and hit 'Enter'. And this also refers to the window object. If I expand the object, there is the confirm method. I am going to transition back to Theia.
Now in the Theia lab environment, I'm going to comment out the confirm message. And I'm going to console.log(window). I will clear my terminal and run the node: index.js command again. And now there's a new error message: window is not defined. To take this further, I'm going to comment out the console.log, and I'm going to console.log(this). And I will clear my terminal again and execute the index.js file. And now in the terminal, there's an empty object. There's some scoping involved. But right now, this references the object node creates for any module exports. Currently, there are no modules being used hence the empty object. And the discussion about modules is out of scope for this video.
Farish has worked in the EdTech industry for over six years. He is passionate about teaching valuable coding skills to help individuals and enterprises succeed.
Previously, Farish worked at 2U Inc in two concurrent roles. Farish worked as an adjunct instructor for 2U’s full-stack boot camps at UCLA and UCR. Farish also worked as a curriculum engineer for multiple full-stack boot camp programs. As a curriculum engineer, Farish’s role was to create activities, projects, and lesson plans taught in the boot camps used by over 50 University partners. Along with these duties, Farish also created nearly 80 videos for the full-stack blended online program.
Before 2U, Farish worked at Codecademy for over four years, both as a content creator and part of the curriculum experience team.
Farish is an avid powerlifter, sushi lover, and occasional Funko collector.