Skip to content

Commit

Permalink
add new test case for splice b00tc4mp#160
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelbarzi committed Oct 3, 2024
1 parent 74c5b4f commit 5b93607
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ console.log(nums)
console.log(extracted)
// [400, 500, 600, 700]

console.log('CASE extract elements from index 2 and delete 2')
console.log('CASE extract elements from index 1 and delete 2')

var nums = [100, 200, 300, 400, 500, 600, 700]
var extracted = nums.splice(1, 2)
Expand Down
4 changes: 1 addition & 3 deletions staff/manuel-barzi/playground/iterables/splice.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ var splice = function (iterable, start, deleteCount) {
for (var i = start; i < start + deleteCount; i++) {
var element = iterable[i]

delete iterable[i]

removed[removed.length] = element
removed.length++
}
Expand Down Expand Up @@ -67,7 +65,7 @@ console.log(nums)
console.log(extracted)
// { 0: 400, 1: 500, 2: 600, 3: 700, length: 4 }

console.log('CASE extract elements from index 2 and delete 2')
console.log('CASE extract elements from index 1 and delete 2')

var nums = { 0: 100, 1: 200, 2: 300, 3: 400, 4: 500, 5: 600, 6: 700, length: 7 }
var extracted = splice(nums, 1, 2)
Expand Down

0 comments on commit 5b93607

Please sign in to comment.