Each time i find a sequence of characters 'eho' , 'piere' remove it from the initial string and print the modified string.Which is the best method to do it in javascript?
Input peshoishere eho piere Output psishere ssh
output = input.replace(/eho/g, '').replace(/piere/g, '');
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace
you need to do this as a RegExp to replace ALL instances of the the pattern