Add different type variables together : Number « Data Type « JavaScript DHTML






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

1.Convert a number to a precision
2.Fix a number
3.Convert a Number to a Exponential format
4.Convert a number to string by append empty string to it
5.Compare the value for integer numbers
6.Integer math calculation
7.Calculate the average for integers
8.Convert from Celsius to Fahrenheit
9.Convert Fahrenheit to Celsius
10.Calculate circle area/Peri/Calculate sphere volume
11.Declare float point number, boolean value and null value
12.Hexadecimal Numbers
13.Check if it is a number and calculate the cubic power
14.Read a number and compare its value
15.Using Binary Flags