Today I was trying to write a simple program to solve the Math "Problem of the Month" at my school. The problem was fairly simple and I had already solved it by hand. I decided to try a brute force approach looping using various bounds for a and b. When I run this in IE it's fine but NS 4.7 gives me an error that says "try is a reserved identifier." Are try/catch blocks not allowed or implemented differently in Netscape?
The page is found at
This isn't anything urgent. Just a curiosity about browser differences in implementation of JavaScript.
Thanks for any help.
<script language="javascript">
var sum=0;
var outstr="The integers (a,b) which satisfy the problem are:<br>";
for(var a = -100;a<=100;a++)
{
for(var b = -100;b<=100;b++)
{
try
{
sum = Math.sqrt(a + Math.sqrt(-b)) + Math.sqrt(a - Math.sqrt(-b));
if(sum==4)
outstr += "<font size=\"3\"><b>("+a+","+b+"
</b></font><br>";
}
catch(err)
{}
}
}
document.write(outstr);
</script>
The page is found at
This isn't anything urgent. Just a curiosity about browser differences in implementation of JavaScript.
Thanks for any help.
<script language="javascript">
var sum=0;
var outstr="The integers (a,b) which satisfy the problem are:<br>";
for(var a = -100;a<=100;a++)
{
for(var b = -100;b<=100;b++)
{
try
{
sum = Math.sqrt(a + Math.sqrt(-b)) + Math.sqrt(a - Math.sqrt(-b));
if(sum==4)
outstr += "<font size=\"3\"><b>("+a+","+b+"
}
catch(err)
{}
}
}
document.write(outstr);
</script>