What does javascript function return in the absence of a return statement?

Solution 1:

A function without a return statement (or one that ends its execution without hitting one) will return undefined.

And if you use the unary negation operator twice on an undefined value, you will get false.

You are not seeing anything on the console because Firebug doesn't prints the result of an expression when it's undefined (just try typing undefined; at the console, and you will see nothing).

However if you call the console.log function directly, and you will be able to see it:

function foo(){}

console.log(foo()); // will show 'undefined'

Solution 2:

<html>
<body>
<script>
function a() {}
alert(a());
</script>
</body>
</html>