Wrong output in Javascript calling function -
i'm trying print result of javascript function, instead whole function
output
x7: function function () { return "hello form function"; }
i want output: hello form function
html
<p id="demo"></p>
javascript
var x7 = function (){ return "hello form function"; }; document.getelementbyid("demo").innerhtml = "x7: " + typeof x7 + "<br>"+x7+"<br>";
you have use parentheses call function: x7()
:
<!doctype html> <html> <body> <p id="demo"></p> <script> var x7 = function (){ return "hello form function"; }; document.getelementbyid("demo").innerhtml = "x7: " + typeof x7 + "<br>"+ x7()+"<br>"; </script> </body> </html>
Comments
Post a Comment