How would i make this code from this lesson https://www.freecodecamp.org/challenges/sift-through-text-with-regular-expressions work when using it in function? I tried it but it returns Invalid Javascript.
function myFunction(word) {
var string = "Michael is 22 and he is a web designer and he is also developer";
var find = /word/gi;
var count = string.match(find).length;
return count;
}
myFunction("is");