Essential JavaScript
Introduction
JavaScript Basics
Numbers
Strings
Logic
Variables
Loops
Objects
Arrays
Arrays Intro
Making Arrays
Array Builder Kata
Array Elements
Human Names Kata
Array Length
Longest Array Kata
Looping Over Arrays
Highest Number Kata
Word Hunter Kata
Array Average Kata
Min-Max Kata
Adding Elements
Number Range Kata
Removing Elements
Arrays of Objects
Biggest Animal Kata
Arrays of Arrays
Taboo Words Kata
Going Further
Essential JavaScript
Introduction
JavaScript Basics
Numbers
Strings
Logic
Variables
Loops
Objects
Arrays
Arrays Intro
Making Arrays
Array Builder Kata
Array Elements
Human Names Kata
Array Length
Longest Array Kata
Looping Over Arrays
Highest Number Kata
Word Hunter Kata
Array Average Kata
Min-Max Kata
Adding Elements
Number Range Kata
Removing Elements
Arrays of Objects
Biggest Animal Kata
Arrays of Arrays
Taboo Words Kata
Going Further
Updating Properties
We have seen how we can access properties with dot notation or bracket notation:
We can use the same syntax to perform other operations on object properties.
Updating Properties
We can use dot notation or bracket notation to update properties:
const person = { name: 'John Doe', age: 22, }; person.age++; console.log(person.age); person.name += ' Sr.'; console.log(person['name']);
Adding Properties
We can even add new properties:
const person = { name: 'Jane Doe', age: 22, }; person.job = 'Game Developer'; console.log(person);
Learning Goals
I can update properties on an object
I can add new properties to an object
Code Editor
Click "Run Code" to execute your JavaScript in a secure sandbox and see the output below.
Console Output
// Console output will appear here...
0 output lines