TIL: JavaScript Objects & Accessing Properties

twitter logo github logo ・1 min read

Today, I created my very first JavaScript object!

var myDog = {
  "name": "Cheeto",
  "enemies": "Puppy the cat"

I was also able to access properties with dot and bracket notation

>var nameval = myDog.name; // "Cheeto"
>var enemiesval = myDog.enemies; // "Puppy the cat"
var nameValue = myDog["Name"]; // Cheeto
var enemiesValue = myDog['enemies']; // Puppy the cat 
twitter logo DISCUSS
Classic DEV Post from Apr 15 '19

The Many Flavors of Technical Presentations

Learn about various technical presentation formats to choose the best one for you

Vicki (she/her) profile image

Sore eyes?

dev.to now has dark mode.

Go to the "misc" section of your settings and select night theme ❤️