Objects in javascripts?
- by admin
- 0
Objects are building blocks of javasript. “Class” keyword not using in javascript. Its all about objects.
All components in javascripts are objects, Strings, functions etc..
Loaded window of js(html page) also consider as an object, it is called “winodw object” or global object.
declaration of object:
Two methods are there:
1.var myobj={
fname:”joe”,//Property
lname:”john”,//Property
fullname: function (){
console.log(this.fname +” ” + this.lname);
}
}
this is usually called literal object.
2. function myobjs(){
this.name= “john”; //Property
this.age= “20”; //Property
this.nameandage= function(){ // Method
console.log(this.name+’with age’+this.age);
}
}
this is constructor method to call object.
Objects are building blocks of javasript. “Class” keyword not using in javascript. Its all about objects. All components in javascripts are objects, Strings, functions etc.. Loaded window of js(html page) also consider as an object, it is called “winodw object” or global object. declaration of object: Two methods are there: 1.var myobj={ fname:”joe”,//Property lname:”john”,//Property fullname:…
Objects are building blocks of javasript. “Class” keyword not using in javascript. Its all about objects. All components in javascripts are objects, Strings, functions etc.. Loaded window of js(html page) also consider as an object, it is called “winodw object” or global object. declaration of object: Two methods are there: 1.var myobj={ fname:”joe”,//Property lname:”john”,//Property fullname:…