Table of Contents
ECMAScript support
EcmaScript 5.1
Full support.
ECMAScript 2016+
- arrow functions MDN.
- async/await ECMAScript tc39.
- classes declarations ECMAScript 6, MDN.
- class private fields MDN..
- computed property names ECMAScript 6, MDN.
- destructuring parameters and assignments MDN.
for...of
statements ECMAScript 6, MDN.- function default parameters MDN.
- function rest parameters MDN.
- generators ECMAScript 6, MDN.
let
andconst
bindings (complete) ECMAScript 6, MDN.- modules (import and export) ECMAScript 6, ECMAScript 2018, MDN, MDN.
- map/weakmap ECMAScript 6, ECMAScript 6, MDN, MDN.
- new.target MDN.
- set/weakset ECMAScript 6, ECMAScript 6, MDN, MDN.
- spread syntax MDN.
- symbols.
- promises ECMAScript 6, MDN.
- proxy objects ECMAScript 6, MDN.
- reflect ECMAScript 6, MDN.
- template strings ECMAScript 6 tagged, ECMAScript 6, MDN.
- typed arrays.
- BigInt ECMAScript 2021 MDN.
??
and?.
operators MDN, MDN.
Extensions
Hop extends some standard JavaScript classes.
String.prototype.naturalCompare( string1, string1 )
This function compares string1
and string2
according to a natural
string order. It returns a negative integer if string1
< string2
. It
returns zero if the string1
equal string2
. It returns a positive
integer if string1
> string2
.
Examples:
"foo".naturalCompare( "foo" ) -> 0
"foo0".naturalCompare( "foo1" ) -> -1
"foo1".naturalCompare( "foo" ) -> 1
"rfc822.txt".naturalCompare( "rfc1.txt" ) -> -1
"1.002".naturalCompare( "1.010" ) -> -1
Array.prototype.filterMap( proc, [ thisArg ] )
As Array.prototype.map
but filters out elements for which proc
returns
false
.
Examples:
[1, -1, 2, -3 ].filterMap( x => x > 0 ? x * 10 : false ) -> [ 10, 20 ]
[1, -1, 2, -3 ].map( x => x > 0 ? x * 10 : 0 ) -> [ 10, 0, 20, 0 ]