oject syntax in js code example

Example 1: javascript object

var	person = {
	first_name : "Marty",
  	last_name : "Mcfly",
	born : 1968,
	died : 1933,
    lovers: ["Jennifer Parker","Baines McFly"]
};

Example 2: 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 live in ${person.city}.`;
console.log(message);

Tags:

Java Example