Why return statements won't print in the console?

I’m not sure if this is expected but I can’t make sense of why it would.

I’ve been using replit only because it was recommended by a Udemy course instructor and despite his version being different (old repl.it) I see that the return statements in his console do print the values in the console. That’s what I expected since it’s the same behavior on cmd with node or V8 in browsers.

I tested it using Node.js and Typescript, both show the same behavior.

Expected:
image

(I would add the current and other examples for the expected but as a new user I can’t add more than one media to the post).

Windows 11 Version 10.0.22621 Build 22621
Microsoft Edge Version 119.0.2151.58 (Official build) (64-bit)
Google Chrome Version 119.0.6045.124 (Official Build) (64-bit)
https://replit.com/@YamGarcia

This is what I expected:
image

1 Like

are you calling the function with parentheses ()?

3 Likes

Yes
image

Is that not what you expect?

return statements won’t print unless you console.log them. Only one will show up because you only used one “console.log”

1 Like

I guess I was expecting the same as here:

wow that must be a long time ago!

I understand what you are saying though.
Regular js files shouldn’t print on return unless logged.
But this kind of environment used to be like this.
Is there a way to get something like this? :sweat_smile:

were you thinking about interactive console (formally called “prybar”)? Because no version of javascript or node.js outputted the contents of all function return day.

I’m not sure about this prybar, but the functionality I expected is the same as node in the terminal or the browser console. It seems pretty standard to me if I’m not actually programming a .js file.

Not sure what you mean with the last comment though. Is there something behind a paid wall I could use?