Skip to content
This repository has been archived by the owner on May 15, 2022. It is now read-only.

Commit

Permalink
Finalizado Exercicio 2
Browse files Browse the repository at this point in the history
  • Loading branch information
gmarcon83 committed Mar 10, 2021
1 parent b9f51e4 commit e4718e0
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
1 change: 1 addition & 0 deletions Dia 19 - CSS - GRIDs e Listas/D19E7 - Copia Soul Code
Submodule D19E7 - Copia Soul Code added at 06339f
60 changes: 59 additions & 1 deletion Dia 30 - JS - Array/D30E1 - Exercícios Array.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,20 @@
}
</style>

<script>
<!-- <script>
// ▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲
// ▲▼▲▼▲▼▲▼ Exercício 1 ▲▼▲▼▲▼▲▼
// ▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲
let produto = [];
produto.nome = "TNT Original";
produto.marca = "TNT";
produto.precoDeCusto = 3.5;
produto.precoDeVenda = 6.8;
produto.estoque = 165;
let arr = [
obterNumero(),
obterNumero(),
Expand All @@ -51,9 +59,59 @@
}
return numInp;
}
</script> -->

<script>

// ▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲
// ▲▼▲▼▲▼▲▼ Exercício 2 ▲▼▲▼▲▼▲▼
// ▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲

let nums = [
obterNumero(),
obterNumero(),
obterNumero(),
obterNumero(),
obterNumero()
];

escreverNaTela("Array ficou: ", arrayParaString(nums));
escreverNaTela("Invertida ela fica: ", arrayParaString(nums, true));


function arrayParaString(umaArray, invertida) {
let strFinal = "";
console.log(strFinal)
if (invertida == undefined || invertida == false) {
for (item of umaArray) {
strFinal = strFinal + item + ", ";
}
} else {
for (item = umaArray.length - 1; item >= 0; item--) {
strFinal = strFinal + umaArray[item] + ", ";
}
}
console.log(strFinal)
return strFinal.slice(0, -2);
}

function escreverNaTela(mensagem, valor) {
document.writeln(mensagem + " <span>" + valor + " </span></br>");
}

function obterNumero() {
let numInp;
while (numInp <= 0 || isNaN(numInp)) {
numInp = parseInt(prompt("Insira um número inteiro"));
}
return numInp;
}


</script>



</head>

<body>
Expand Down

0 comments on commit e4718e0

Please sign in to comment.