Download presentation
Presentation is loading. Please wait.
1
did a few weeks ago. tag would work.
2
Declare variables - note the ; at the end of the line.
This shows the loop - I put the test at the end so the loop always gets executed once - knowing the data, this was fine but in other situations I might use other code. Note that the if is enclosed in { }. True False writes on the screen.
3
The if statement has the conditions in parenthesis and the code if true enlosed in one set of { } and the code if false enclosed in another { }. These also tell us when the if has ended.
4
This program, like the previous one, was executed when I clicked on the link and the result was displayed using document.write which writes on the document in the browser (the screen).
6
if (workAns == thirdNum)
This means that fourth/Num is divided by 2 and the answer is assigned back to fourthNum, changing what is in fourthNum. Note that the = is an assignment sign that assigns the calculation on the right to the variable on the left.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.