Object Property Access

Objects allow us to store multiple related variables in one place. Instead of having this:
var playerX = 250;
var playerY = 100;
var playerWidth = 50;
var playerHeight = 50;

We can do this:
var player = { x:250, y:100, width:50, height:50 }
We can also have the same properties in different objects, so player.x is different from enemy.x

Example:

var person = {
  name: "steve",
  age: 28,
  hairColor: "brown"
}

//We can access these properties like so:
person.age += 1;

console.log("Happy birthday: " + person.name);

Object Property Access courses

Intro to Scratch: Game Development

Build your own version of The World's Hardest Game and learn the Scratch programming language while doing it!

Exercises: Objects

Practice using objects in JavaScript

Exercises: Objects

Practice using objects in JavaScript

Exercises: Objects

Practice using objects in JavaScript

Exercises: Objects

Practice using objects in JavaScript

Exercises: Objects

Practice using objects in JavaScript

Exercises: Classes

Classes generate objects while your program is running. They can also give different types of objects internal methods. For example a Car class objectmight have a method called Drive(). It's very useful to think of your data as classes and objects.

Helicopter Game

Create a game where the player pilots a helicopter with the mouse and collects coins while avoiding obstacles

Snowflakes

An Introduction to JavaScript using Objects

Visual Effects lessons

VFX lessons in JavaScript

Bouncing Rainbow Squares

Visual Effects lessons

VFX lessons in JavaScript

Bouncing Rainbow Squares

Object Property Access lessons

Intro to Scratch Games 2: Drawing Sprites and Patrolling Enemies

In this lesson you will learn to draw your own sprites and add simple patrolling enemies.

Exercises: Objects 11

Special attacks

Exercises: Objects 10

Using the moves we have created for attacking

Exercises: Objects 8 Modifying Nested Objects

Learn to use functions to change values in nested objects

Exercises: Objects 9 Objects with Arrays

use objects with arrays

Exercises: Objects 12 The in operator

learn about in

Exercises: Objects 13 other ways to access properties

access properties using [ ]

Exercises: Objects 14 for in loops

loop through the properties of an object

Exercises: Objects 6 - Nested Objects

An introduction to objects with more complicated properties

Exercises: Objects 7 Accessing Properties of Nested Objects

Access two layers deep

Exercises: Objects 1 - Creating Objects

Accessing object properties.

Exercises: Objects 2 - Accessing Properties

Modifying object variables

Exercises: Objects 3 - Different Objects, Same Property

Objects within objects

Exercises: Objects 4 - Modifying Properties

change the value of properties within an object

Exercises: Objects 5 - Setting Properties

Set properties of an object to specific values

Write a function that creates an Object

Create a function which in turn creates a new Object when it's called

Helicopter Game: Movement and Coins

In the first part of this course we will be making a simplified version of the game which allows the player to move and to collect coins

Drawing Objects

Motivated/Experienced Free Trial (6th Grade and up)

Bouncing Rainbow Squares!

Use JavaScript to make fun bouncing patterns

Bouncing Rainbow Squares!

Use JavaScript to make fun bouncing patterns

Related Links

No links found
About Object Property Access

Objects are variables with a bunch of properties which you can access and modify

Badge

Object Property Access