javascript - Do I have to assign a function result to a variable before I return it? -


i expected following 2 code snippets equivalent:

function waitfirstloadhtml(message) {     var r = '<div class="form-blocker">' +     '<span class="ui-corner-all">' + message + '</span>' +     '</div>';     return r; } 

and

function waitfirstloadhtml(message) {     return '<div class="form-blocker">' +     '<span class="ui-corner-all">' + message + '</span>' +     '</div>'; } 

but somehow first 1 returns string value expected, while second 1 returns undefined. idea why?

i've had trouble putting strings on multiple lines in javascript - work if do:

function waitfirstloadhtml(message) {     return '<div class="form-blocker"><span class="ui-corner-all">'+message+'</span></div>'; } 

Comments