JavaScript DOM Scripting By Example Improving the Application Code Refactor 2: Readable Branching Logic

Marcus Schumacher
Marcus Schumacher
10,547 Points

Where to learn more about these kinds of JS object abilities?

At 3:50 in the video, what is going on here? Where can I read or learn more about this? I didn't know that objects in JS can have properties that are functions themselves. What would you call this kind of function declaration in an object?

At 6:48, how does this type of accessing work? Does it treat the object like an array? Whatever is in the brackets is selected from the object? What is this called? How could I learn more? Thanks. This is new stuff for me :)

1 Answer

Steven Parker
Steven Parker
153,114 Points

An object property that is also a function is known as a "method".

The access technique you are referring to is called "bracket notation". It's an alternative to the more commonly used "dot notation".

You might enjoy exploring objects further in the recently revamped course Object-Oriented JavaScript.