String.prototype.substringintermediateconst str = 'Hello, World!'
str.substring(7, 12) // β 'World'
str.substring(5, 2) // β 'llo' (args swapped)
str.substring(7) // β 'World!'Use substring() to extract characters between two indices, automatically swapping them if start is greater than end.
Unlike slice, if start > end, .substring() swaps them automatically.
Challenge: Implement substringSwap(str) that calls substring(5, 2) and relies on auto-swap.
substringSwap('abcdefgh') // β 'cde' (same as substring(2, 5))