// Using {} to create empty objects: let person = {}; // Using Object() to create empty objects: let person = new Object(); // Using function constructor: function Person(name, age) { this.name = name; this.age = age; this.showName = () => console.log(this.name); } let person = new Person(‘Amy’, 28); person.showName();
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter