javascript - How to push only the elements not found in my array -


so question asking me remove punctuation word , know how cross-reference tho arrays check if element exists in array checked how push values not in punctuation array?

function removepunctuation(word){   var punctuation = [";", "!", ".", "?", ",", "-"];   var chars = word.split("");   var puncremoved = [];   for(var = 0; < chars.length;i++){     for(var j = 0; j < punctuation.length;j++) {       if(punctuation[j].indexof(chars[i]) !== 0) {         puncremoved.push(i)       }     }   }   return puncremoved; } 

word.replace(/[;\!\.\?\,-]/g, ''); 

you might find this interesting :d


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -