Question about javascript from a rookie.
I need your help, thank you.
Asked
Active
Viewed 38 times
0
isherwood
- 52,576
- 15
- 105
- 143
yukina hanasaki
- 1
- 2
-
2In the future, please post your code and not images of your code. – isherwood Oct 15 '18 at 16:31
2 Answers
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().
-
He's displaying the return of the function `sayHi`, not the `console.log` – Orelsanpls Oct 15 '18 at 16:33