programming exercise
Task 5
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 6
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:
# | Title | Academic Level | Subject Area | # of Pages | Paper Urgency |
---|---|---|---|---|---|