Skip to main content
Switch to spread operator
Source Link
azz
  • 221
  • 1
  • 5

JavaScript ES7, 37 3333 25 bytes

Pretty simple approach using ES6 Set and ES7 Array comprehensionsArray comprehensions spread operator:

s=>[for(c of s=>[...new Set(s))c]].join`` 

1422 bytes less than the indexOf approach. Worked on a handful of test cases.

JavaScript ES7, 37 33 bytes

Pretty simple approach using ES6 Set and ES7 Array comprehensions:

s=>[for(c of new Set(s))c].join`` 

14 bytes less than the indexOf approach. Worked on a handful of test cases.

JavaScript ES7, 37 33 25 bytes

Pretty simple approach using ES6 Set and ES7 Array comprehensions spread operator:

s=>[...new Set(s)].join`` 

22 bytes less than the indexOf approach. Worked on a handful of test cases.

Not sure how that space slipped by un-removed...; edited body
Source Link
azz
  • 221
  • 1
  • 5

JavaScript ES7, 37 3433 bytes

Pretty simple approach using ES6 Set and ES7 Array comprehensions:

s=>[for (c of new Set(s))c].join`` 

1314 bytes less than the indexOf approach. Worked on a handful of test cases.

JavaScript ES7, 37 34 bytes

Pretty simple approach using ES6 Set and ES7 Array comprehensions:

s=>[for (c of new Set(s))c].join`` 

13 bytes less than the indexOf approach. Worked on a handful of test cases.

JavaScript ES7, 37 33 bytes

Pretty simple approach using ES6 Set and ES7 Array comprehensions:

s=>[for(c of new Set(s))c].join`` 

14 bytes less than the indexOf approach. Worked on a handful of test cases.

Remove space after Set() and made function anonymous.
Source Link
azz
  • 221
  • 1
  • 5

JavaScript ES7, 3737 34 bytes

Pretty simple approach using ES6 Set and ES7 Array comprehensions:

f=s=>[fors=>[for (c of new Set(s)) c].join`` 

1013 bytes less than the indexOf approach. Worked on a handful of test cases.

JavaScript ES7, 37 bytes

Pretty simple approach using ES6 Set and ES7 Array comprehensions:

f=s=>[for (c of new Set(s)) c].join`` 

10 bytes less than the indexOf approach. Worked on a handful of test cases.

JavaScript ES7, 37 34 bytes

Pretty simple approach using ES6 Set and ES7 Array comprehensions:

s=>[for (c of new Set(s))c].join`` 

13 bytes less than the indexOf approach. Worked on a handful of test cases.

Source Link
azz
  • 221
  • 1
  • 5
Loading