Add different type variables together : Number « Data Type « JavaScript DHTML
- JavaScript DHTML
- Data Type
- Number
Add different type variables together
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
var num1 = 1;
var num2 = 2;
var num3 = 3;
var fourthvar = "4";
var name1 = "a";
var name2 = "b";
alert(num1 + num2);
alert(num3 + fourthvar);
alert(name1 + name2);
</script>
</body>
</html>
Related examples in the same category