Dev Dives: Streamline document processing with UiPath Studio Web
w3schools%20javascript%20comments
1. Web Authoring Name:
Lesson Completion Sheet
W3School JavaScript
JavaScript Comments, Variables, If…Else, Switch, Operators
For this lesson, you will be going through the JavaScript Comments tutorial on the W3Schools web site located at
www.w3schools.com/js/js_comments.asp, then the JavaScript Variables tutorial on the W3Schools web site located
at www.w3schools.com/js/js_variables.asp, then the JavaScript If…Else tutorial on the W3Schools web site located at
www.w3schools.com/js/js_if_else.asp, then the JavaScript Switch tutorial on the W3Schools web site located at
www.w3schools.com/js/js_statements.asp, then the JavaScript Operators tutorial on the W3Schools web site
located at www.w3schools.com/js/js_operators.asp .
All files that you save as part of this lesson should be saved in a folder called JavaScript Comments inside a folder called
w3school javascript that you create in your network folder for this course.
Assignments X X Grade
Read through the JavaScript Comments tutorial.
Use notepad to create an HTML document. Include a JavaScript section made up of document.write /10
statements that would create this: (use one document.write statement for each line)
<h1>Athletics</h1>
<h2>Boys</h2>
<ul>
<li>Basketball</li>
<li>Soccer</li>
<li>Track</li>
</ul>
<h2>Girls</h2>
<ul>
<li>Basketball</li>
<li>Soccer</li>
<li>Volleyball</li>
</ul>
- Add this multi-line comment at the beginning of the script:
This script shows a list of
boys and girls athletic offerings
- Add a single line comment This is the list of boys sports between the Boys header and the beginning of
the list.
- Prevent the list item Track from being displayed by commenting it
- Prevent the entire list under the Girls heading from being displayed by using a multiline comment
- Add an end of line comment aka Sports to the Athletic header line
Save your HTML document as comment1.htm
Read through the JavaScript Variables tutorial.
Look at the Variable example. Use notepad to create an HTML document that contains JavaScript code /10
that will save five different words as five different variables, then display those five words. Save your
document as variable1.htm.
Read through the JavaScript If..Else tutorial.
Look at the If statement example. Use notepad to create an HTML document. Copy the HTML from /10
the example into your HTML document. Get rid of the stuff in the p tags. Add to the script so that the
greeting “Lunch time!” if the hour value of the time is 12 (12:00-12:59pm) and “Good afternoon” if the
time is greater than 12 (1pm or later). Save your document as if1.htm.
I:My Documentsweb authoringassignmentsw3schools javascript basicw3schools javascript comments.docx Page 1 of 2
2. Look at the If…else statement example. Use notepad to create an HTML document. Copy the HTML /10
from the example into your HTML document. Get rid of the stuff in the p tags. Change getHours in the
script to getDay, this will give the day of the week, numbered 0-6 (Sunday=0, Monday=1, etc). Change
the script so that on Fridays (day 5), it will display “Thank goodness its Friday!” and so that it will
display “It’s not Friday yet.” On all other days. Save your document as if2.htm.
Look at the If…else if…else statement example. Use notepad to create an HTML document. Copy the /10
HTML from the example into your HTML document. Get rid of the stuff in the p tags. Change getHours
in the script to getMonth, this will give the month of the year, numbered 0-11. Change the script so
that in January – May it will display “I can’t wait for summer”; during June, July and August, it will
display “I love the summer!” and in September – December it will display “I can’t wait for summer”
again. Save your document as if3.htm.
Look at the Random link example. Use notepad to create an HTML document. Make an h1 header /10
that says “Coin Toss”. Include a JavaScript script that displays a picture of heads or a picture of
tails.based on the random number generate in the script. Save your document as if4.htm ;
Read through the JavaScript Switch tutorial.
Look at the Switch Statement example. Use notepad to creat an HTML document. Write a JavaScript /10
script that uses the getMonth command to get the current month number (0-11) then displays the
actual month name. Save your document as switch1.htm
Read through the JavaScript Operators example.
Use notepad to create an HTML document. Think of a sentence that is five words long. Write a /10
JavaScript script that stores each of these words in a variable then writes the whole sentence by
“adding” these five variables together. Save your document as operator1.htm.
/80
When you have completed the assignments for this lesson, staple any printouts to the back of this sheet in order and
hand it in to the teacher.
I:My Documentsweb authoringassignmentsw3schools javascript basicw3schools javascript comments.docx Page 2 of 2