How to access declared objects in javascript ( object instances )

Object instance need to access properties and methods of an object.

When we used constructor method to define objects, we need to create an instance of the object to use the properties and methods of that object.

function myobj(){ “joe”;  //Property
this.age= “20”;   //Property
this.nameandage= function(){   // Method
console.log(’with age’+this.age);

        To create an instance of this object :
var insta_myobj= new myobj(); // creating instance using “new” keyword
insta_myobj.nameandage(); // accessing Method


In literal object definition:

No need to create a specific instance of this object call the properties and methods.

var myobj={
fullname: function (){
console.log(this.fname +” ” + this.lname);

we can call these properties and functions as: