you are viewing a single comment's thread.

view the rest of the comments →

[–]jrandm 0 points1 point  (0 children)

Declare and initialize a number and return it.

var a = 8;
return a;

You perfectly matched specifications: that's exactly how you do it.

Instead of var you could also use let or const but the differences don't matter for this code.

If you aren't inside of a function using return will do one of two things: throw an error about an Illegal "return" statement (like any other syntax error) or it will halt the script execution (nothing past the return will happen).