Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 . Add a element to the body where you'll place JavaScript code for Lab 1 . 2 . Create a variable called name using

1. Add a element to the body where you'll place JavaScript code for Lab 1.
2. Create a variable called name using let and assign your full name to it.
3. Use document.writeln() to output "Lab 1. Completed by " and your name variable using string concatenation.
4. Use console.log() to output "This is Lab 1. Completed by "+ name. Note: press F12 or go to Tools -> Developer Tools in you browser to open the Developer Tools. Then in Developer Tools, open "Console" to see the output.
5. Output content to the div with id="output" using the following assignment statement: document.getElementById('output').innerHTML = "This is my first JavaScript lab assignment.";
6. Add a for loop that outputs all values from 1-10. Use document.getElementById().innerHTML to output the value to the div with id="values". You must output all 10 values using the loop (not a single output statement). Separate each value with an HTML
element.
7. Add a while loop that adds all values from 1-10 together as a sum and output the final value. Use document.getElementById().innerHTML to output the value to the div with id="sum".
8. Create 3 numeric variables a, b, and c. Assign values to them. Output their sum using a document.writeln() statement.
9. Use a condition to compare variables a and b. Output "a < b" or "a > b" using a document.writeln() statement.
10. Use an alert() to output the value of your name variable and the results of typeof name

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago