Javascript examples for Data Type:var
The var statement declares a variable.
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//from www .j a va 2 s . c o m var lastName = "Bond"; document.getElementById("demo").innerHTML = "Name: " + lastName; } </script> </body> </html>