Javascript examples for Function:Function Return
Return string from function
<html> <head></head> <body> <script> var someVariable = "this is test"; function alertSomething() {/* w w w . j a v a 2 s . c o m*/ console.log(someVariable); } function returnSomething(){ return someVariable; } var a = alertSomething(); var b = returnSomething(); console.log("the alert method doesn't return a value: " + a); console.log("return: " + b); </script> </body> </html>