Shallow Copy

Slice() method is available for Strings and Arrays in Javascript. It has two optional parameters which we can use in different combinations to get interesting results. It does not make modifications to the original array/string. We can use negative indexes with the slice() method which makes it even more useful. The method returns a shallow… continue reading