$("#submit").on('click', function () {
let height1 = parseInt($("#numIn1").val());
let height2 = parseInt($("#numIn2").val());
let height3 = parseInt($("#numIn3").val());
let height4 = parseInt($("#numIn4").val());
let height5 = parseInt($("#numIn5").val());
let height6 = parseInt($("#numIn6").val());
let height7 = parseInt($("#numIn7").val());
let heightsArray = [height1, height2, height3, height4, height5, height6, height7];
let resultOut = new Array();
resultOut.push(heightsArray[0]);
let highest = 0;
let currentHeight = 0;
for (let index = 1; index <= heightsArray.length - 1; index++) {
currentHeight = heightsArray[index];
if (currentHeight > highest) {
resultOut.push(currentHeight);
highest = currentHeight;
}
$("#results").html(`The building(s) that can see the sunset are: [${resultOut.toString()}].`);
}
});
$("#clear").on('click', function () {
$("#numIn1").val("");
$("#numIn2").val("");
$("#numIn3").val("");
$("#numIn4").val("");
$("#numIn5").val("");
$("#numIn6").val("");
$("#numIn7").val("");
$("#resultOut").val("");
});