"use strict"; function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } } var addCounter = function addCounter(list) { //list.concat([0]) return [].concat(_toConsumableArray(list), [0]); }; var removeCounter = function removeCounter(list, idx) { return list.slice(0, idx).concat(list.slice(idx + 1)); }; var incrementCounter = function incrementCounter(list, index) { return [].concat(_toConsumableArray(list.slice(0, index)), [list[index] + 1], _toConsumableArray(list.slice(index + 1))); }; var testAddCounter = function testAddCounter() { var listBefore = []; var listAfter = [0]; expect(addCounter(listBefore)).to.eql(listAfter); }; var testRemoveCounter = function testRemoveCounter() { var listBefore = [0, 10, 20]; var listAfter = [0, 20]; expect(removeCounter(listBefore, 1)).to.eql(listAfter); }; var testIncrementCounter = function testIncrementCounter() { var listBefore = [0, 10, 20]; var listAfter = [0, 11, 20]; expect(incrementCounter(listBefore, 1)).to.eql(listAfter); }; testAddCounter(); testRemoveCounter(); testIncrementCounter(); testAddCounter(); console.log("ALL TEST PASS");