Created
December 23, 2020 20:04
-
-
Save DoctorDerek/c86c2927276662e869d1f2fc1e257c50 to your computer and use it in GitHub Desktop.
What Are the Object Property Accessors in JavaScript?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const object = { zero: "0️⃣" } | |
| const array = ["⛳"] | |
| console.log(object.zero) // 0️⃣ | |
| console.log(object["zero"]) // 0️⃣ | |
| console.log(array[0]) // ⛳ | |
| object["one"] = "1️⃣" | |
| object.two = "2️⃣" | |
| array[1] = "🏌️♂️" | |
| array[2] = "🎱" | |
| console.log(object.one) // 1️⃣ | |
| console.log(object["two"]) // 2️⃣ | |
| console.log(array[1]) // 🏌️♂️ | |
| console.log(array[2]) // 🎱 | |
| const symbol = Symbol("🍠") | |
| object[symbol] = "😋" | |
| console.log(object[symbol]) // 😋 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment