Front-end Web Development
Assignment for Week 8
- Create an HTML file. (Start with the HTML file in Assignment 1 as a basis. Feel free to skip the CSS creation/linking steps.)
- Create a JS file (a blank file with a
.js extension).
- Add a
<script> tag to the end of the <body> in the HTML file. Set its src attribute to the name of your JS file.
- In the JS file, declare a varlable called
x.
- Assign the number 1000 as the value of
x.
- Declare a variable called
y and assign the number 234 as its value.
- Declare a variable called
sum and assign it the sum of x and y (JavaScript should do this math, not you).
- Declare a variable called
message and assign it a string that says, in sentence form, what the sum is (concatenation is necessary).
- Use the
alert DOM function to show the message to the user.
Extra credit:
- Redo the above without declaring any variables.
Solution