Javascript
is weakly typed language. You can assign any type of data to a variable.
For
example,
var a =
10;
a = "Hello
World";
a = true;
a = 10.09;
As you see
above example, I can able to assign a number, string, boolean values to same
variable ‘a’. But it is not the case in strongly typed languages like C and
Java.
variables.html
<!DOCTYPE html> <html> <head> <title>Variables</title> </head> <body> <script type="text/javascript"> var a = 10; document.write("Value of a is " + a + "<br />"); a = "Hello World"; document.write("Value of a is " + a + "<br />"); a = true; document.write("Value of a is " + a + "<br />"); a = 10.09; document.write("Value of a is " + a + "<br />"); </script> </body> </html>
No comments:
Post a Comment