function replaceAll(str: string, find: string, replace: string) {
return str.replace(new RegExp(find, 'g'), replace);
}
let s: string = "typescript java c c++ java c# java php python";
const toremove: string = "java";
s = replaceAll(s, toremove, '');
console.log(s);
/*
run:
"typescript c c++ c# php python"
*/