Objects have properties and methods, - Node.js Object

Node.js examples for Object:Property

Description

Objects have properties and methods,

Demo Code



/**/*from  ww  w  . j  a va 2 s  .c  o m*/
 * Objects have properties and methods
 *
 * Methods are functions that have the `this` bonus param assigned to
 * the object that the method was called on.
 */

function sayHello(){
  console.log("Regular ol' function call", this);
}

sayHello();


var zuri = {
  name: 'Zuri',
  sayHello: function(){
      console.log('method function call. This:', this);
  }
};

zuri.sayHello();

Related Tutorials