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}
1function userCreator (name, score) {
2 const newUser = Object.create(userFunctionStore);
3 newUser.name = name;
4 newUser.score = score;
5 return newUser;
6};
7
8const userFunctionStore = {
9 increment: function() {
10 this.score++;
11 },
12
13 login: function() {
14 console.log("Logged in!");
15 }
16};
17
18const user1 = userCreator("Justin", 41);
19const user2 = userCreator("Rainer", 5);
20user1.increment();
21console.log(user1.score) // 42
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*/
1const person = {
2 name: 'Anthony',
3 age: 32,
4 city: 'Los Angeles',
5 occupation: 'Software Developer',
6 skills: ['React','JavaScript','HTML','CSS']
7}
8
9//Use Template Literal to also log a message to the console
10const message = `Hi, I'm ${person.name}. I am ${person.age} years old. I live in ${person.city}. I am a ${person.occupation}.`;
11console.log(message);