JavaScript String: substring, substr, slice
My opinion is that substring’s swapping of parameters violates the principle of least surprise. Since it’s such a common use-case, I think it’s worth pointing out that substr and slice can use negative indices to extract from the end of the string, while ...