ran npm run tdd & generated TDD
This commit is contained in:
9
test/pullAtIndex/pullAtIndex.js
Normal file
9
test/pullAtIndex/pullAtIndex.js
Normal file
@ -0,0 +1,9 @@
|
||||
module.exports = (arr, pullArr) => {
|
||||
let removed = [];
|
||||
let pulled = arr
|
||||
.map((v, i) => (pullArr.includes(i) ? removed.push(v) : v))
|
||||
.filter((v, i) => !pullArr.includes(i));
|
||||
arr.length = 0;
|
||||
pulled.forEach(v => arr.push(v));
|
||||
return removed;
|
||||
};
|
||||
Reference in New Issue
Block a user