Can someone explain to me why this is:
<html>
<head></head>
<body>
<script>
try {
document.attribute-withminus = 5;
}
catch(e) {
alert('something went wrong');
}
alert('ok');
</script>
</body>
</html>
Doesn't he warn me that "something went wrong", and also there is no warning with "normal"?
It works great in chrome. But in firefox, it just exits (it shows an error in the web console). The whole point of this attempt is to make sure that if I print something wrong, this should give me a warning saying so. I do not want the web console to open all the time.
Also, I know what's wrong here (minus sign attribute, should use setAttribute). I ask why my mistake was not caught.
source
share