Understanding JavaScript Array methods (2): slice


An idiomatic way to create shallow copies of arrays uses slice. This post dives into the slice method and describes a few more tips and tricks. At the end of this post you should know the output of [1,2,3].slice(-3,-1). Slice The full method signature is arr.slice(start, end). Start and end are optional parameters defaulting to 0 and arr.length respectively. … Continue reading Understanding JavaScript Array methods (2): slice