Question about javascript from a rookie.
I need your help, thank you.
Asked
Active
Viewed 42 times
0

isherwood
- 58,414
- 16
- 114
- 157

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
- 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()
.
-
He's displaying the return of the function `sayHi`, not the `console.log` – Orelsanpls Oct 15 '18 at 16:33