36 lines
1.1 KiB
HTML
36 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<!--
|
|
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/html.html to edit this template
|
|
-->
|
|
<html>
|
|
<head>
|
|
<title>Challenge 4</title>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<script type="text/javascript">
|
|
var names = new Array(2);
|
|
var name;
|
|
for (let i = 0; i < names.length; ++i) {
|
|
name = prompt("Give me a name.");
|
|
names[i] = name;
|
|
console.log(i);
|
|
}
|
|
|
|
if (names[0].charAt(0) > names[1].charAt(0)) {
|
|
var tmp = names[0];
|
|
names[0] = names[1];
|
|
names[1] = tmp;
|
|
}
|
|
|
|
for (let i = 0; i < names.length; ++i) {
|
|
document.write(names[i] + "</br>");
|
|
console.log(names[i]);
|
|
console.log(typeof(names[i]));
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
|
|
</html>
|