JavaScript Questionnaire I
isNaN("a112") // returns true
isNaN(112) // returns false
var x=1.7976931348623157E+10308;
document.write(x); // returns infinity
var x = 4/0;
document.write(x); // returns infinity
var y=-1.7976931348623157E+10308;
document.write(y); // returns -infinity
<html>
<head>
<script language="JavaScript">
function Click(obj)
{
alert(obj.value);
}
</script>
</head>
<body>
<input type="button" value="Click" onclick="JavaScript:Click(this)"/>
</body>
</html>
document.forms[0].submit();
<html>
<head>
<script language="JavaScript">
alert(navigator.appVersion);
</script>
</html>
alert('1' + 2 + 4);
alert(5 + 4 + '3');
var x = 1;
var y = '1';
if (x == y) {
alert("This message will pop up only when they are equal");
}
var x = 1;
var y = '1';
if (x === y) {
alert("This message will pop up only when they are equal");
}
var obj;
alert(obj);
alert(typeof obj);
var obj = null;
alert(obj);
alert(typeof obj);
<script type="text/javascript">
var my_alert = function ShowAlert() {
alert("This is the test message");
}
my_alert();
</script>
<a href="javascript:scroll(0,0);">
Top
</a>