Javascript examples for Function:Function Return
Return an object from a function
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//ww w. j a v a2 s .c o m var optionScope= new function() { return { data: function () { return {stage:'defaultValue'} } } } optionScope.data().stage = 'b'; console.log(optionScope.data().stage) } </script> </head> <body> </body> </html>