I am trying to match word in javascript if i use **'if'** and **'split'** method each time I stuck in the **case-sensetive**.

If I am using regExp then if a part of word matched it returned true **(i.e : hii , /hi/)**. What I do do to match case-insensitive and whole word should be match.

### Code of the regEx

```
async function matchOne(str ,mtc) {
  let returnval;
  let words = str.split(' ')
  await words.forEach(word => {
    if (word.match(mtc)) {
      returnval = true;
      return true
    }
  });
  if (returnval === true) {
    return true;
  } else {
    return false;
  }
}
matchOne(string,regEx)

```

### Code of the if statement

```
async function matchOne(str ,mtc) {
  let returnval;
  let words = str.split(' ')
  await words.forEach(word => {
    if (word == mtc) {
      returnval = true;
      return true
    }
  });
  if (returnval === true) {
    return true;
  } else {
    return false;
  }
}

matchOne(string,string)

```