M
Matt
I want to know if var a = 3 and var a = "3" make any differences? So in JavaScript,
we always use var type? there is no integer type?
If I compare 3 > 2 and 3 > "2", it doesn't make any differences.
Also, in (1), I don't understand why it returns false,
but if i just do alert(a > b);, then it returns true.
<html><body>
<script type="text/javascript">
var a = 3;
var b = 2;
if (a > b) alert("Case 1: " + a > b); //false <== (1)
var x = "3";
var y = "2";
if (x > y) alert("Case 2: " + x > y); //true
</script>
</body>
</html>
any ideas? thanks!!
we always use var type? there is no integer type?
If I compare 3 > 2 and 3 > "2", it doesn't make any differences.
Also, in (1), I don't understand why it returns false,
but if i just do alert(a > b);, then it returns true.
<html><body>
<script type="text/javascript">
var a = 3;
var b = 2;
if (a > b) alert("Case 1: " + a > b); //false <== (1)
var x = "3";
var y = "2";
if (x > y) alert("Case 2: " + x > y); //true
</script>
</body>
</html>
any ideas? thanks!!