I need help


#1

var remove = function(contacts,value){
var idx = contacts.indexOf(value);
if (idx !=== -1) {
contatcs.splice(idx,1);


#2
var contacts=['a','b','c','d'];
var removedResult;

var remove = function(contacts,value){
       var idx = contacts.indexOf(value);
        if (idx !== -1) {
               removedResult=contacts.splice(idx,1,'r');
        }
};
console.log( contacts );
remove(contacts,'a');
console.log( contacts );
console.log( removedResult );

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice