1let object = {
2 'key1': 'value1',
3 'key2': 'value2',
4 'keyn': 'valuen',
5};
6console.log(object);
1let obj = {
2// fields
3 name:"value",
4 num: 123,
5//methods
6 foo: function(){}
7
8}
1let myDog = {
2 legs: value
3
4}
5 console.log(myDog);
6/*Doesn't have to be a Dog it can be anyting you want*/
1class ObjectLayout {
2 constructor() {
3 this.firstName = "Larry"; //property
4 }
5
6 sayHi() { // Method
7 return `Hello from ${this.firstName}`;
8 }
9}
10
11const object = new ObjectLayout();
12// object.firstName is Larry;
13// object.sayHi() gives "Hello from Larry"
1function Dog() {
2 this.name = "Bailey";
3 this.colour = "Golden";
4 this.breed = "Golden Retriever";
5 this.age = 8;
6}