Incorrect TypeError


#1

Raising TypeError when I run this code on one code cell. :worried:
But, Not raised TypeError when I ran this code on two cells.

I searched this issue on this forum. But I can’t found one.

If this is not wrong, please help me to better method.

Thank you.


#2

Hey there!

The output is indeed correct. If you run the code in node yourself, you’ll see the same thing.

The reason for the error is because there is no semicolon at the end of line one. By ending the line with a function call the next line is trying to access the “)” property of the returned value (undefined).

Here’s another example that better illustrates it:

Please let me know if you have any questions.


#3

Oh, sorry, I know that.
I understand that this is correct as you said.

Thank you for your quick answer! :laughing: