7 Ways to Create Object in JavaScript

https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Object-oriented_JS

So what is Object?

var object = new Object();
var object = Object.create(null);
var object = {};
function Person(name){
var object = {};
object.name=name;
object.age=21;
return object;
}
var object = new Person("🇮🇳 Ashish 🇮🇳");
function Person(){}
Person.prototype.name = "🇮🇳 Ashish 🇮🇳";
var object = new Person();
class Person {
constructor(name) {
this.name = name;
}
}

var object = new Person("🇮🇳 Ashish 🇮🇳");
var object = new function(){
this.name = "Sudheer";
}

Conclusion

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store