Skip to content

Commit

Permalink
atividades_js
Browse files Browse the repository at this point in the history
  • Loading branch information
R7zx committed Jul 1, 2022
1 parent 822733e commit 36aa795
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 24 deletions.
8 changes: 4 additions & 4 deletions animais.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
let capivara = {
altura: "60cm",
altura: "60cm",
peso: "7 toneladas",
habitat: "floresta",
cor: "vermelha",
especie: "mamífero",

andar:function () {
andar: function () {
console.log("pak pak pak pak")
},
comer:function () {
comer: function () {
console.log("nhac nhac nhac")
},
correr:function (){
correr: function () {
console.log("zunnnn.. zunnnnn.. iunnnnnn")
}
}
Expand Down
58 changes: 58 additions & 0 deletions attCadastro.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!DOCTYPE html>
<html lang="pt-br">

<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>cadastro</title>
</head>

<body>
<input id="entrada" type="text" placeholder="Insira seu nome">
<input id="idade" type="number" placeholder="Insira sua idade">
<br><br>
<hr>
<br>
<p id="p"></p>
<button id="salvar" type="button">Salvar</button>
<button id="verificar" type="button">verificar</button>
</body>

</html>

<script>

let array = [];

document.getElementById("salvar").addEventListener("click", function () {

let objeto = {
entrada: document.getElementById("entrada").value,
idade: document.getElementById("idade").value,

};


array.push(objeto);


});

document.getElementById("verificar").addEventListener("click", function () {

for (let index = 0; index < array.length; index++) {
let element = array[index];
console.log(array[index].entrada);
console.log(array[index].idade);


if (array[index].nome == 'raysson') {
document.getElementById("p").innerText = array[index].idade;
}
}
console.log(array);
});


</script>
36 changes: 36 additions & 0 deletions exOrdenacao.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="pt-br">

<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>orden</title>
</head>

<body>
<input type="text" id="numeros">
<div id="resultado"></div>
<input type="button" id="btnSalvar" value="salvar">
</body>

</html>

<script>
let array = [];

document.getElementById("btnSalvar").addEventListener("click", function () {
let num = document.getElementById("numeros").value;

array.push(num);

array.sort(ordena);

document.getElementById("resultado").innerText = array;

});

function ordena(a, b) {
return a - b;
}
</script>
38 changes: 18 additions & 20 deletions inputArray.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,32 @@
<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>Array E Js</title>
<title>orden</title>
</head>

<body>
<input type="text" id="numeros">
<div id="resultado"></div>
<input type="button" id="btnSalvar" value="salvar">
</body>

<input type="number" id="entrada">
<br><br>
<button type="button" id="verificar" onclick="inserir()">verificar</button>
<p id="p">aaaaaaa</p>
<script>

document.getElementById("entrada").addEventListener('click', inserir);
</html>

function inserir() {
<script>
let array = [];

var campo = document.getElementById("entrada").value;
var input = Number(campo);
const array = array[","];
var botao = document.getElementById("verificar");
var texto = document.getElementById("p");
document.getElementById("btnSalvar").addEventListener("click", function () {
let num = document.getElementById("numeros").value;

input.unshift(campo);
array.push(num);


}
array.sort(ordena);

document.getElementById("resultado").innerText = array;

</script>
</body>
});

</html>
function ordena(a, b) {
return a - b;
}
</script>

0 comments on commit 36aa795

Please sign in to comment.