Slice vs Clone object

Edit on GitHub

Slice vs obj creation

Setup

var arr = [120,230]
var obj = {x:120,y:230};

Tests

  • Slice

    arr.slice(0)
  • Clone object

    Object.create(obj)