<!-- javaScript variables can hold many data types: numbers, strings, arrays, objects and more: -->
<script type="text/javascript">
var n = 10; // n is number datatype
document.write(n,"<br>");
</script>
<script type="text/javascript">
//strings datatype
var s = "Rohit"; // s is strings datatype
document.write(s,"<br>");
</script>
<!--arrays datatype-->
<p id = "demo"></p>
<script>
var a = ["Bumrah", 'arrsys', 123, 12.12];
document.getElementById("demo").innerHTML = a[0];
</script>
<!--object datatype -->
<script type="text/javascript">
var x = {firstname:"milan", secondname:"bakotra"};//x is object
document.write(x.firstname," ",x.secondname, "<br>");//firstname and second name is properties
</script>
Comments
Post a Comment