Showing posts with label Easter Break. Show all posts
Showing posts with label Easter Break. Show all posts

Saturday, April 18, 2009

Shanti Javascript Holiday Homework

Howdie!

The javascript output is as follows:

0
10
10
0
-5
3
0
NaN
value=54
9=value
0.5
2
0.5
Infinity
-Infinity
NaN
5
NaN
one=2 two=2
one=2 two=1
false
false
false
false
true
true
false
true
true
true
true
false
true
true
false
false
false
true
false
false
null
null
false
0
0
false
0


undefined
undefined
true
false
1
undefined





The HTML code can be found below:


<html>
<head>
</head>

<body>
<pre>
<script type="text/javascript">
document.writeln("1" * "0");
document.writeln("1" + 0);
document.writeln(1 + "0");
document.writeln("1"* "0");
document.writeln(- - -5);
document.writeln(true ? 3 : false ? 5 : 0);
document.writeln("1" * false);
document.writeln("1" * "false");
document.writeln("value=" + 5 + 4);
document.writeln(5 + 4 + "=value");
document.writeln(2/4);
document.writeln(4.0/2.0);
document.writeln(2.0/4);
document.writeln(5/0);
document.writeln(-5/0);
document.writeln(0/0);
document.writeln(+ "5");
document.writeln(+ "a");
var one=1; var two=++one; document.writeln("one=" + one + " two=" + two);
var one=1; var two=one++; document.writeln("one=" + one + " two=" + two);
document.writeln(5==="5");
document.writeln("hello" === "HELLO");
document.writeln(NaN === 5);
document.writeln(NaN === NaN);
document.writeln(null===null);
document.writeln(undefined===undefined);
document.writeln(null===undefined);
document.writeln(null==undefined);
document.writeln("1" == true);
document.writeln("1" ==1);
document.writeln(1==true);
document.writeln("Z" < "A");
document.writeln("Z" < "a");
document.writeln("Zelda" < "Zoo");
document.writeln("zelda" < "Zoo");
document.writeln(true < 1);
document.writeln(1 < "true");
document.writeln("11" < "3");
document.writeln("11" < 3);
document.writeln("one" <3);
document.writeln(null && true);
document.writeln(null && false);
document.writeln(false && null);
document.writeln(0 && true);
document.writeln(0 && false);
document.writeln(false && 0);
document.writeln(true && 0);
document.writeln("" && true);
document.writeln("" && false);
document.writeln(undefined && true);
document.writeln(undefined && false);
document.writeln(!!5);
document.writeln(!!null);
document.writeln(null ? 0 : 1);
document.writeln(void (1+2));
</script>
</pre>

</body>

</html>