0

Question about javascript from a rookie.

I need your help, thank you.

code

isherwood
  • 58,414
  • 16
  • 114
  • 157

2 Answers2

0

It says undefined because nothing get returned by the function sayHi ; and you are displaying the return of the function.

function sayHi() {
  console.log('Hello');
}

console.log(sayHi());

function sayHi2() {
  console.log('Hello');
  
  return 'returned value';
}

console.log(sayHi2());
Orelsanpls
  • 22,456
  • 6
  • 42
  • 69
0

Because you console.log() your console.log().

You only need to call instructor.sayHi() or your sayHi function should return a string that you console.log().

isherwood
  • 58,414
  • 16
  • 114
  • 157
Nico_
  • 1,388
  • 17
  • 31