Amandeep Pasricha14,928 Points
Do you always have to write a variable for a return value?
Hi, I know this sounds like an obvious question, but how we know when to make a variable or not. I was literally thinking of just putting Math.floor into the function without creating a variable for it. Why would that be wrong?
Do you always need to create a variable?
Steven Parker174,023 Points
The "return" statement takes any expression, it can be a variable, but it could also be a formula, literal, function call, etc.
return size * base + 2; // a calculation return price(item); // call another function return "Standard"; // a literal (string in this case)