I have made a function which is used to delete a certain word from a variable i also made.
var eliminateWord = function (usedwords){word2.replace (/go/g," ");
but i cant seem to use the function in this code:
var word1 = "go",
word2 = "go to the shops everyday and buy chocolate.";
var eliminateWord = function (usedwords){
word2.replace (/go/g," ");
};
if (word2.match("go")) {
console.log("user entered go");
eliminateWord ();
}
if (word2.match("to")) {
console.log("user entered to");
}
if (word2.match("the")) {
console.log("user entered the");
}
if (word2.match("and")) {
console.log("user entered and");
}
console.log(word2);