programming exercise
Javascript coding
Task 1
Write a JavaScript code using nested for loop (A nested loop is a loop within a loop ) to print your name number of times depending on the inserted value from the user.
The output should be something similar to the following if the value inserted is 3:
Tam
TamTam
TamTamTam
PUT THE FINAL CODE HERE
Task 2
using the example below
<!DOCTYPE html>
<html>
<body>
<h1>WPDAM – JS Array – Example 3</h1>
<p id=”P1″></p>
<script>
function askUser()
{
var userData = new Array ();
userData [0] = prompt(“What is your name?”);
userData [1] = prompt(“What is your age?”);
userData [2] = prompt(“What is your mobile number?”);
return userData;
}
var tmp = askUser();
document.getElementById(“P1”).innerHTML =
“Your Name is: ” + tmp[0] + “<br>” +
“Your Age is: ” + tmp[1] + “<br>” +
“Your Mobile number is: ” + tmp[2] + “<br>”;
</script>
</body>
</html>
– Add suitable comments for each statement.
– Edit the code to:
a. Accept email address from the user.
b. Check the age value is between 6-90 years old.
c. Check the mobile value is numbers only.
d. Check the email address value is correct.
e. If any value entered by the user in (b),(c) and (d) is incorrect
– Alert the user Please insert a correct value
– Repeat ask the user until the data entered is valid.
PUT THE FINAL CODE HERE
You can place an order similar to this with us. You are assured of an authentic custom paper delivered within the given deadline besides our 24/7 customer support all through.
Latest completed orders:
# | topic title | discipline | academic level | pages | delivered |
---|---|---|---|---|---|
6
|
Writer's choice
|
Business
|
University
|
2
|
1 hour 32 min
|
7
|
Wise Approach to
|
Philosophy
|
College
|
2
|
2 hours 19 min
|
8
|
1980's and 1990
|
History
|
College
|
3
|
2 hours 20 min
|
9
|
pick the best topic
|
Finance
|
School
|
2
|
2 hours 27 min
|
10
|
finance for leisure
|
Finance
|
University
|
12
|
2 hours 36 min
|