How can I incorporate an if statement into my code to print different statements based on different scenarios? For example, I want a statement for when the sum is less than 1, and another for when the sum is greater than 1. I attempted to use examples from W3Schools, but the if statement did not work as expected.
<!DOCTYPE html>
<!-- Network Latency Calculator -->
<html>
<head>
<meta charset = "utf-8">
<title>Network Latency Calculation</title>
<script>
var firstNumber; // user-entered value
var secondNumber; // user-entered value
var thirdNumber; // user-entered value
var fourthNumber; // user-entered value
var number1;
var number2;
var number3;
var number4;
var sum;
// read in values from user
firstNumber = window.prompt( "Enter the Propagation time (in milliseconds)" );
secondNumber = window.prompt( "Enter the Transmission time (in milliseconds)" );
thirdNumber = window.prompt( "Enter the Queuing time (in milliseconds)" );
fourthNumber = window.prompt( "Enter the Propagation delay (in milliseconds)" );
// convert input to integers
number1 = parseInt( firstNumber );
number2 = parseInt( secondNumber );
number3 = parseInt( thirdNumber );
number4 = parseInt( fourthNumber );
sum = number1 + number2 + number3 + number4;
// display the results
document.writeln( "<h1>The network latency is " + sum + "</h1>" );
</script>