JavaScript objects

by danielkwood

HTML

<html>
    <head>
        <title>Objects</title>
        <script src="script.js"></script>
    </head>
        
    <body>

    </body>
</html>

JavaScript

// Create an object

var person = {
  firstName: "Joe",
  lastName: "Smith",
  age: 20,
};

// Display the firstName property's value in the console:

console.log(person.firstName);

// Change the person's age:
person.age = 21;