Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

This shorthand syntax is also known as the concise method syntax. It’s valid to have spaces in the property name.

let server = {
    name: 'Server',
    restart() {
        console.log("The " + this.name + " is restarting...");
    },
    'starting up'() {
        console.log("The " +  this.name + " is starting up!");
    }
};

server['starting up']();
Code language: JavaScript (javascript)
Source by www.javascripttutorial.net #
 
PREVIOUS NEXT
Tagged: #This #shorthand #syntax #concise #method #valid #spaces #property
ADD COMMENT
Topic
Name
1+2 =