JavaScript program for objects

 var a = {

    fname: "Gaurav",

    lname:"Soni",

    age:21,

    favmovies:["Dhoom","Avatar","Jurassic park"],

    salary: function(){

        return 25000;

    },

    Fullname: function(){

        return this. fname +" "+this. lname;

    },

    living:{

        city:"Jaipur",

        country:"India",

        

    }

   

}

document.write(a.favmovies+"<br>");

document.write(a.salary()+"<br>");

document.write(a. Fullname ()+"<br>");

document.write(a.living.city);


Output




Comments