Today we'll do ... well at least these topics: 1) Functions .......................... DONE 2) File Based Modules 3) Internal Modules 4) External Node Modules First of all, what is a module? A module is like a .... header file in C/C++, in Node.js. A module can have multiple functions, states, properties, definations and a lot more... Before we dive into modules, lets do some basics first (this will help us in understanding modules better)... ------------------------------- OBJECTS ---------------------------- An object in Node.js has some "key" and "value" pairs. It is very different from objects in C++/Java (where an object is basically an implementation of class....where we say class is a blueprint of an object). Here it is a bit different because the objects here don't follow all the OOPs properties... Lets do a quick example So, that is how you declare an object. We just declared an object in Node. It is really simple... We c...
// Arrays var myArray = []; // adding an element to the array myArray . push ( 1 ); // print the array: console . log ( myArray ); // add another element myArray . push ( 5 ); // print array console . log ( myArray ); // pop an element myArray . pop ( 1 );
Comments
Post a Comment