JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<head>
<title>Exercicio com Arrays</title>
<meta charset="utf-8">
<script type="text/javascript" src="scripts.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
</head>
<body>
<div class="container-fluid text-center">
<div id="site">
<div id="fibonacci">
<fieldset>
<legend>Sequência de Fibonacci:</legend>
Limite Fibonacci: <input type="number" id="numFibonacci" min="1" value="1"><br>
<button>Exibir elemento na posição</button>
</fieldset>
</div>
<div id="vetor">
<form id="formVetor" action="post">
<fieldset>
<legend>Vetor</legend>
<input type="text" name="inputVetor" id="input0">
<input type="text" name="inputVetor" id="input1">
<input type="text" name="inputVetor" id="input2">
<input type="text" name="inputVetor" id="input3">
<input type="text" name="inputVetor" id="input4">
<input type="text" name="inputVetor" id="input5">
<input type="text" name="inputVetor" id="input6">
<input type="text" name="inputVetor" id="input7">
<input type="text" name="inputVetor" id="input8">
<input type="text" name="inputVetor" id="input9">
</fieldset>
<button name="exibir" onClick="calcularMaior()">Exibir MAIOR elemento</button>
<button name="exibir">Exibir MENOR elemento</button>
</form>
</div>
</div>
</div>
</body>
</html>
CSS
div#site{
margin-top: 20px;
}
div#fibonacci{
width: 50%;
float: left;
}
div#vetor{
width: 50%;
float: right;
}
input#numFibonacci{
width: 60px;
margin-bottom: 5px;
}
input[name="inputVetor"]{
width: 45px;
margin-left: 5px;
margin-right: 5px;
}
legend{
font-weight: bold;
}
button[name="exibir"]{
margin-left: 5px;
margin-right: 5px;
margin-top: 5px;
}
JavaScript
var i;
function calcularMaior() {
var n = new Array(10);
for(i = 0; i < 10; i++) {
var input = "input";
var inputNumero = "" + i.toString();
var inputId = input.concat(inputNumero);
n[i] = document.getElementById(inputId).innerHTML;
}
alert("Array 0 = " + n[0];
}