JS.Help

JS.Help

    Object

    • Methods
    • Syntax

    Object in Javascript

    What is an object?

    An object is a collection of related data or functionality.

    How to declare an object?

    let person = {}

    This object is empty, because there no data inside curly brackets.

    What is inside object?

    Usually inside there are pairs of name/value separated by comma. The name and the value are separated by colon.

    let person = { name: 'John', age: 27 }

    The value can be anything in Javascript. It can be a string, a number, a function or an array.

    Dot notation

    Bracket notation

    • What is an object?
    • How to declare an object?
    • What is inside object?
    • Dot notation
    • Bracket notation