text.touppercase bukan fungsi

var hello = "Hello, ";

function greet(names) {

  if (name == null) {
    console.log(hello + "my friend")
  } else if (name == name.toUpperCase()) {
    console.log(hello.toUpperCase() + name.toUpperCase())
  } else {
    console.log(hello + name);
  }
}

var names = ["jack", "john"]
greet(names);
 Run code snippetHide results
Brave Bee