0

Question about javascript from a rookie.

I need your help, thank you.

code

isherwood
  • 52,576
  • 15
  • 105
  • 143

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
  • 20,654
  • 4
  • 36
  • 61
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
  • 52,576
  • 15
  • 105
  • 143
Nico_
  • 1,148
  • 14
  • 29