> Le 16 nov. 2015 à 09:18, Jordan Harband <[email protected]> a écrit : > > > 3) The naming is set in stone - `reduceRight` sets a clear precedent that > "right" is "the length minus one",
True, but `.reduceRight` is for arrays, for which there does not exist a strong natural notion of "right-to-left" that has nothing to do with order. > and has no relationship to the visual direction, and based on `trimLeft` and > `trimRight`, which are already implemented in basically all browsers Thus, in > ECMAScript, "left" is not considered a visual direction but rather a synonym > for "start" and "index 0". The naming is also mentioned here: > https://github.com/tc39/proposal-string-pad-left-right#naming > <https://github.com/tc39/proposal-string-pad-left-right#naming> When we have two existing competing precedents in the language (left/right vs. starts/ends), why choose to be consistent with the bad one instead of the good one? A plausible argument for keeping `left/right` would be that other languages have `padLeft`/`padRight`. However, a simple google search shows that better-named `padStart` and `padEnd` are also in use. —Claude
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

