Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var removeFromArray = function() {
- for(var i=0; i<arguments.length; i++){
- console.log(arguments[i]);
- }
- var newtab = [], temp = [], temp2 = [], tab=arguments[0];
- for(let j=0; j<tab.length; j++)
- {
- if(tab[j] == arguments[1])
- {
- if(j == 0)
- newtab=tab.slice(1, (tab.length));
- else if(j == (tab.length-1))
- newtab=tab.slice(0, (tab.length-1));
- else
- {
- temp=tab.slice(0, j);
- temp2=tab.slice((j+1), (tab.length));
- newtab = temp.concat(temp2);
- }
- }
- }
- return newtab;
- };
- module.exports = removeFromArray
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement