How to declare an object in javascript?

How to declare classes in jaascript?

Objects are building blocks of javasript. “Class” keyword not using in javascript. Its all about objects.

Two methods are there:

literal object.

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

we can access the properties through the methods used inside the objects, couldn’t call properties directly as myobj.fname;
Javascript constructor.

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