>const sum = array.reduce(Math.add); It is better not to do this... because the Array#reduce passed 4 parameters to callback. >array.sort((a, b) => a - b); This comparator will not give you a good result when the platform does not support denormalized numbers, as the difference 2.225073858507202e-3
>or it need to return {value: {value: "end", done: true}, done: true}
this case is supported, seems, if to use:
function* b() {
return yield* a()
}
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
Roman numerals are already supported by ECMAScript Internationalization API Specification:Try in Safari Browse:```new Intl.NumberFormat("it-u-nu-roman").format(10);```
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/e
if "{}+{}" is a statement, than how can it return (or yield) a result?
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
> What about the Timsort?
I cannot believe it will be faster on random int array. And TimSort is base on
MergeSort and, seems, for it's worst cases it cannot be better than MergeSort.
I have tried https://github.com/mziccard/node-timsort/ with my old node.js -
0.10.4 and Chrome 49 (win32) - and
@Tab Atkins Jr.,
The only question is how much slower/more expensiver stable sorting is than
unstable sorting, and whether that cost is sufficient to outweigh the
usefulness of a stable sort.
My own experiment shows, that QuickSort (unstable) is ~20% (or more) faster on
"random" array of intege
> `arr.indexOf(arguments[0]) - arr.indexOf(arguments[1])`
This will work only if `arr` is a copy of an array which you are trying to
sort, because the algorithm may swap those elements and so reposition them
relative to other elements ...
Stable sort is useful sometimes, but it is possible to
> There was a SpiderMonkey bug1, and even a patch, for this for quite a while.
> The patch now landed and will be in Firefox 29.
>V8 got fixed last week too
>code.google.com/p/v8/issues/detail?id=3069
but according to spec, "forEach" should call callback with "-0":
var map = new Map();
map.set
8 matches
Mail list logo