I came across following code in a tutorial. I originally thought the
word 'stay' in (!stay) was not important, and could be replaced by
another word. The negation mark (!) was doing the whole work. But when
replacing the 'stay' with another word, such as 'remain', the if
conditional did not work.
As far as I know, 'stay' is not a reserved word, and is not defined in
the code, either. How come it is a must?
<html>
<head>
<script type='text/javascript'>
var stay=confirm ("The following site contains appalling material
suitable only for webmasters. Please 'ok' to enter, 'cancel' to exit
immediately!")
if (!stay){
window.location="http://www.yahoo.com"
}
</script>
</head>
<body>
Appalling material here
</body>
</html>
The web page is in:
http://www.pinyinology.com/learning/stay.html
Thanks.
Dung Ping