Video Notes:
Video 5 of Node JS Tutorial, thenewboston
Video 5 of Node JS Tutorial, thenewboston
Video Name: Understanding References to Objects
- in node, everything is a reference
- everything is interconnected, as a reference
- == means it only compares the value
- === means it only compares type and value
Video Name: this
- "this" is a keyword
- used to refer to the thing that called it (can be an explicit object)
- a true or false situation
- if you make a function that does not belong to any object, it is global
- your entire program will then call it - refers to global
Video 7 of Node JS Tutorial, thenewboston
Video Name: Prototype
- can add cool methods or properties to objects in classes (a hierarchy system?)
- can add additional functions onto a user object
- every instance has access to new function
- use the command called "prototype"
Video 8 of Node JS Tutorial, thenewboston
Video Name: Modules
- files often can contain thousands of lines, as a result, it can get really messy, and unorganized
- code can be broken up into different files
- these files are called modules
- to make modules, you group similar code together
- ex: a streaming service like Netflix offers movies, TV shows, and more, the code could be broken up into modules, there would a module for movie-related code, and a module for TV show-related code
- modules, therefore, are more specific
- to do this, you would make a new file
- code can be specifically exported into the main app file
- "module.exports" is the command that determines what code will be exported, and when you type this keyword, you can tag on any variable in the code
- to import another module, you set it equal to a variable
- use the keyword "require" to simply state: we are requiring a module, or code from a file
- ex: ./movies - look in the same directory looking for the movies.js
Video 9 of Node JS Tutorial, thenewboston
Video 9 of Node JS Tutorial, thenewboston
Video Name: More on Modules
- there are more efficient ways to export code
- a default module.exports is always running behind the scenes, when you type an edited module.exports, it will look for the code you referenced, and then export it
- you can write your functions directly in this object, so all the code is directly and simultaneously exported
No comments:
Post a Comment