Professional Documents
Culture Documents
209301481
Section F
Assignment 6
QUESTION 1 CODE:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<form action="">
<button onclick="vowel()">VOWEL</button>
</form>
<script>
function vowel() {
n = document.getElementById("word").value;
var j = n.length;
var x = 0;
x = i;
break;
}
document.write("The string entered is:- " + n + "</br>The first vowel from
the left is:- " + n[x] + "</br>");
document.write("The location of the vowel is:- " + x);
}
</script>
</body>
</html>
QUESTION 2 CODE:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form>
<input type="text" id="number">
<button onclick="reverse()">Calculate</button>
</form>
<script>
function reverse() {
var x = document.getElementById("number").value;
var y = x.length;
document.write("The number entered is:- " + x + "</br>");
document.write("The number in reverse order is:- ");
for (var i = y - 1; i >= 0; i--) {
document.write(x[i]);
}
}
</script>
</body>
</html>