Say you have 2 identical functions that do not return a value
function a() {
// do some interesting things
}
function b() {
// do the same interesti
There's no real difference; both will return undefined
.
Functions with no return statement will return undefined
, as will functions with an empty return
statement.
To confirm this for yourself, you can run this code -- FIDDLE:
function a() {
}
function b() {
return;
}
var aResult = a();
var bResult = b();
alert(aResult === bResult); //alerts true