2. NODE.JS
Node.js is a platform to build fast, scalable and
high-throughput network applications
Uses single-threaded Event-Loop & NonBlocking I/O model that makes it lightweight and
efficient use of Server resources
JavaScript Runtime on the Server
Browser based IDE’s
No multi-thread locking burden on the runtime
3. JAVASCRIPT
JavaScript is an object-oriented and
functional style scripting language
Runs on a single-threaded runtime
Dynamic Typing and Prototype-based
var person1 = new Person(‘John’, ‘Smith’);
Type-of-Variable Vs Type-of-Value
4. JAVASCRIPT
Dynamic Typing and Prototype-based language
var person1 = new Person(‘John’, ‘Smith’);
No Person class but a Person Prototype
var Person = function() {
this.fname = "";
this.lname = "";
this.greet = function() {
console.log("Hi, I'm " + this.fname);
};
};
5. JAVASCRIPT INHERITANCE
var Person = function() {
this.fname = "";
this.lname = "";
};
var Employee = function() {
this.title = "";
this.salary = "";
};
Employee.prototype = new Person();
6. JAVASCRIPT FUNCTIONS
Functions are the first-class citizens
Pass around Closure functions makes EventDriven programming simple
Closures
Pass
functions to the method parameters
Method returns data or functions
7. SERVER-SIDE VS CLIENT-SIDE
JavaScript is born and live in the client-side
browsers
Has ability to run on the server-side
Server-side JavaScript will not have the
browser based global objects such as
Window & Document but does have objects
http/url etc provided by the Node.js platform
8. JAVASCRIPT RUNTIME
Node.js uses the Googles V8 JavaScript
Engine used in chrome browser
V8 Runtime Engine uses Heap memory for
JavaScript objects & functions
V8 has Garbage Collection for memory
management
V8 JIT (Just-In-Time) Compiler