I
ivor.horton
i've wrote a javascript program to test the equality of the javascript
special values such as: true,false,null,undefined,NaN,0,1. but the
program can't give me the proper answer, can anyone help me with it ?
great thanks. the code is paste as follows.
---------------------------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<title>Page Title</title>
<script type="text/javascript" charset="utf-8">
var t={
values:[null,undefined,NaN,0,1,true,false],
length:t.values.length,
result:"",
test:function(){
for(var i=0;i<length;i++){
for(var j=0;j<length;j++){
if(values==values[j]){
result+=values+"=="+values[j]+" : true\n";
}else{
result+=values+"=="+values[j]+" : false\n";
}
}
}
alert(result);
}
};
testSpecialValues.test();
</script>
</head>
<body>
</body>
</html>
special values such as: true,false,null,undefined,NaN,0,1. but the
program can't give me the proper answer, can anyone help me with it ?
great thanks. the code is paste as follows.
---------------------------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<title>Page Title</title>
<script type="text/javascript" charset="utf-8">
var t={
values:[null,undefined,NaN,0,1,true,false],
length:t.values.length,
result:"",
test:function(){
for(var i=0;i<length;i++){
for(var j=0;j<length;j++){
if(values==values[j]){
result+=values+"=="+values[j]+" : true\n";
}else{
result+=values+"=="+values[j]+" : false\n";
}
}
}
alert(result);
}
};
testSpecialValues.test();
</script>
</head>
<body>
</body>
</html>