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

qt - QML MouseArea onWheel event not working properly when inside QML Scrollview -

java - is not an enclosing class / new Intent Cannot Resolve Constructor -

python - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -