Answers for "create object in function javascript"

1

make an object javascript

class ObjectLayout {
	constructor() {
    	this.firstName = "Larry"; //property
    }
  
  	sayHi() { // Method
    	return `Hello from ${this.firstName}`;
    }
}

const object = new ObjectLayout();
// object.firstName is Larry;
// object.sayHi() gives "Hello from Larry"
Posted by: Guest on November-03-2020
2

js create object with properties

function Car(make, model, year) {
  this.make = make;
  this.model = model;
  this.year = year;
}
Posted by: Guest on April-01-2020
0

how to create a object in javascript

var a = {
name: "aakash",
  age:30
}
Posted by: Guest on May-16-2020

Code answers related to "create object in function javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language