how to make an object in javascript
let myDog = {
legs: value
}
console.log(myDog);
/*Doesn't have to be a Dog it can be anyting you want*/
how to create an object in javascript
const person = {
name: 'Anthony',
age: 32,
city: 'Los Angeles',
occupation: 'Software Developer',
skills: ['React','JavaScript','HTML','CSS']
}
//Use Template Literal to also log a message to the console
const message = `Hi, I'm ${person.name}. I am ${person.age} years old. I live in ${person.city}. I am a ${person.occupation}.`;
console.log(message);
objects in javascript
var student = { // object name
firstName:"Jane", // list of properties and values
lastName:"Doe",
age:18,
height:170,
fullName : function() { // object function
return this.firstName + " " + this.lastName;
}
};
objects in javascript
var object = {'key':'value','the value can be anything',[1,null,'Dr.Hippo']};
object in javascript
console.log("hello);
|