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 Jan 8

Smart Time Management and Productivity Guide via Weekly Reviews.

As we all know being a competent software developer or engineer means continuously learning throughout your career. It’s great! That makes this profession exciting and allows to escape everyday routine at work. In fact, it’s not a job anymore - it’s a lifestyle πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Vicki profile image
Join dev.to