<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Oil Prices</title>
<script type="text/javascript">
/* <![CDATA[ */
var oilPrice = 52.85;
if (oilPrice > 50) {
if (oilPrice < 60)
document.write("<p>Oil prices are between $50.00 and $60.00 a barrel.</p>");
}
/* ]]> */
</script>
</head>
<body>
</body>
</html>
it then says to modify the nested if statement so it uses a single if statement with a compound conditional expression to determine whether oil prices are between 50 and 60 dollars. The book says that we will need to use the && logical operator. So, what I got is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Oil Prices</title>
<script type="text/javascript">
/* <![CDATA[ */
var oilPrice = 52.85;
if (oilPrice > 50 && <60)
document.write("<p>Oil prices are between $50.00 and $60.00 a barrel.</p>");
}
/* ]]> */
</script>
</head>
<body>
</body>
</html>
Is this right? Am I even on the right track??? Thank you to anyone that helps!

New Topic/Question
Reply



MultiQuote




|