slice vs substring javascirp code example
Example: javascript substring vs slice
The same except:
* if start > stop substring swaps the arguments, slice returns ""
* if argument is NaN or negative, substring will treat it as a 0
* if start is negative, slice sets char from the end of string
* if stop is negative, slice sets stop to string.length – Math.abs(stop)