Everytime I use `setTimeout()`, I wonder why the the arguments are in the
wrong order. Usually the callback functions comes last, but in 'setTimeout'
it's exactly the other way round.
So I propose that the order should be reversed to be consistent with other
functions.
Instead of `setTimeout(callback, delay[, arg][, ...])` it should be
`setTimeout(delay, callback[, arg][, ...])`
By checking the type of the first two arguments (which one is the function)
backwards compatibility can be achieved.
So a polyfill would be something like:
```
newSetTimeout = (delay, callback, ...args) => {
if (typeof delay === 'function') {
setTimeout(delay, callback, ...args)
}
else {
setTimeout(callback, delay, ...args)
}
}
```
What do you think?
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss