Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}\\script.js"
}
]
}
9 changes: 8 additions & 1 deletion Exercicios/10. array.map()/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,11 @@ const usuarios = [
{user:237, name: 'Mariana', idade:15 },
{user:238, name: 'Isis', idade:34 },
{user:239, name: 'Pietra', idade:23 }
]
]

const textoResultado = usuarios.map((participante) => {
return `Nome: ${participante.name}, Idade: ${participante.idade} `
});

console.log(textoResultado)

33 changes: 33 additions & 0 deletions Exercicios/10. array.map()/script2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const vencedores = [
{
nome : "Equipe Super",
pais : "Brasil"

},

{
nome: "Time Maximo",
pais: "EUA"
},
{

nome: "Mega Grupo",
pais: "Canadá"

}
];

const winners = vencedores.map((item) => {
return item.nome;


});

const paises = vencedores.map((item) => {
return item.pais

})


console.log(winners, paises);

17 changes: 17 additions & 0 deletions Exercicios/10. array.map()/script3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const usuarios = [
{user:234, name: 'Marcia', idade:40 },
{user:235, name: 'Lorena', idade:20 },
{user:236, name: 'Patricia', idade:24 },
{user:237, name: 'Mariana', idade:15 },
{user:238, name: 'Isis', idade:34 },
{user:239, name: 'Pietra', idade:23 }
]

const resultadoPietra = usarios.map((users) => {
if (users.user === 239) {
return `Nome: ${users.name}, tem ${users.idade} anos`
}

})

console.log(resultadoPietra);
10 changes: 10 additions & 0 deletions Exercicios/11. array.forEach()/script.js
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
const numbers = [65, 44, 12, 4, 68];

let sum = 0;

numbers.forEach((numero) => {
sum += numero;


});

console.log (sum);
17 changes: 17 additions & 0 deletions Exercicios/11. array.forEach()/script2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const usuarios = [
{user:234, name: 'Marcia', idade:40 },
{user:235, name: 'Lorena', idade:20 },
{user:236, name: 'Patricia', idade:24 },
{user:237, name: 'Mariana', idade:15 },
{user:238, name: 'Isis', idade:34 },
{user:239, name: 'Pietra', idade:23 },
{user:240, name:"Camila", idade: 29}
]

let somaIdades = 0;
usuarios.forEach(function(itens) {
somaIdades += itens.idade;

})

console.log(somaIdades);
1 change: 1 addition & 0 deletions Exercicios/12. array.filter()/script.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
const ages = [32, 33, 16, 40, 2, 69];

4 changes: 4 additions & 0 deletions Exercicios/2. for/script.js
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
const listagemDeFrutas = ["Uva", "Banana", "Manga", "Cajá", "Pinha", "Maçã", "Melão"];

for (let index = 0; index < listagemDeFrutas.length; index++ ){
console.log(listagemDeFrutas[index])
}
5 changes: 4 additions & 1 deletion Exercicios/4. array.push()/script.js
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
const listagemDeFrutas = [ "Uva", "Banana", "Manga", "Cajá", "Pinha", "Maçã", "Melão"];
const listagemDeFrutas = [ "Uva", "Banana", "Manga", "Cajá", "Pinha", "Maçã", "Melão"];

listagemDeFrutas.push("Melancia", "Jaca", "Pêra", "Laranja");
console.log(listagemDeFrutas.length);
8 changes: 7 additions & 1 deletion Exercicios/5. array.pop()/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,10 @@ const usuarios = [
{user:237, name: 'Mariana', idade:15 },
{user:238, name: 'Isis', idade:34 },
{user:239, name: 'Pietra', idade:23 }
]
]

const ultimosElementoListagem = listagemDeFrutas.pop();
console.log(listagemDeFrutas);

const usuariosPop = usuarios.pop();
console.log(usuarios);
9 changes: 8 additions & 1 deletion Exercicios/6. array.shift()/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,11 @@ const usuarios = [
{user:237, name: 'Mariana', idade:15 },
{user:238, name: 'Isis', idade:34 },
{user:239, name: 'Pietra', idade:23 }
]
]

listagemDeFrutas.shift();
console.log(listagemDeFrutas);

usuarios.shift();
console.log(usuarios);

13 changes: 12 additions & 1 deletion Exercicios/7. array.unshift()/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,15 @@ const usuarios = [
{user:237, name: 'Mariana', idade:15 },
{user:238, name: 'Isis', idade:34 },
{user:239, name: 'Pietra', idade:23 }
]
]

listagemDeFrutas.unshift("Laranja", "Goiaba");
console.log(listagemDeFrutas);

usuarios.unshift({
user:233,
name: "Jaqueline",
idade: 36
});

console.log(usuarios);
8 changes: 7 additions & 1 deletion Exercicios/8. array.slice()/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ const usuarios = [
{user:237, name: 'Mariana', idade:15 },
{user:238, name: 'Isis', idade:34 },
{user:239, name: 'Pietra', idade:23 }
]
]

const selectedItens = listagemDeFrutas.slice(2,4);
console.log(selectedItens);

const selectedUsers = usuarios.slice(2,5);
console.log(selectedUsers);
8 changes: 7 additions & 1 deletion Exercicios/9. array.splice()/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ const usuarios = [
{user:237, name: 'Mariana', idade:15 },
{user:238, name: 'Isis', idade:34 },
{user:239, name: 'Pietra', idade:23 }
]
]

countryList.splice(3,1,"Peru");
console.log(countryList);

usuarios.splice(3,1, {user:237, name:"Camila", idade: 29});
console.log(usuarios);
1 change: 0 additions & 1 deletion Exercício de Casa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ Assim, vamos produzir uma nova versão do site previamente elaborado.

6. O livro adicionado permanecerá podendo ser deletado pelo usuário.

7. A informação de data de inserção deverá ser removida da listagem de livros.**Na listagem dos livros inseridos, deverá vir uma informação nova, denominada "Data da inserção", contendo a data e o horário em que o livro foi inserido no sistema**.

8. É preciso seguir a estrutura de repositório contida nessa pasta "Exercício de Casa".

Expand Down
56 changes: 56 additions & 0 deletions Exercício de Casa/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<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">
<link href="./style/style.css" rel="stylesheet" >
<title>Biblioteca</title>
</head>
<body>
<div>
<h1>My Audible Books</h1>
<form action="envio_dados" onsubmit="exibirDados(event)">
<div>
<label for="nomeDoAutor">Autor:</label>
<br><input type="text" name="autor" id="nomeDoAutor"><br><br>
<label for="tituloDoLivro">Titulo:</label>
<br><input type="text" name="titulo" id="tituloDoLivro">
<br><br><label for="isbnDoLivro">ISBN:</label>
<br><input type="text" name="isbn" id="isbnDoLivro">
<br><br><label for="dataDaPublicacao">Data da Publicação:</label>
<br><input type="date" name="data-publicacao" id="dataDaPublicacao">
<br><br><label for="numeroDePaginas">Páginas:</label>
<br><input type="number" name="paginas" id="numeroDePaginas">

</div>
<div>
<br><br><input type="submit" name="enviar" id="botaoAdicionarLivro" value="Adicionar livro"> </input>

</div>

</form>

<table>
<thead>

<tr>
<th scope="col">Autor</th>
<th scope="col">Título</th>
<th scope="col">ISBN</th>
<th scope="col">Data da Publicação</th>
<th scope="col">Páginas</th>
<th scope="col">Data de inserção</th>
</tr>
</thead>
<tbody id="resposta">

</tbody>

</table>


<script type="text/javascript" src="./script/script2.js"></script>

</body>
</html>
58 changes: 57 additions & 1 deletion Exercício de Casa/script/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,107 @@ let books = [
subtitle: "A Modern Introduction to Programming",
author: "Marijn Haverbeke",
published: "2014-12-14T00:00:00.000Z",
pages: 121,
},
{
isbn: "9781449331818",
title: "Learning JavaScript Design Patterns",
subtitle: "A JavaScript and jQuery Developer's Guide",
author: "Addy Osmani",
published: "2012-07-01T00:00:00.000Z",
pages: 12,
},
{
isbn: "9781449365035",
title: "Speaking JavaScript",
subtitle: "An In-Depth Guide for Programmers",
author: "Axel Rauschmayer",
published: "2014-02-01T00:00:00.000Z",
pages: 20,
},
{
isbn: "9781491950296",
title: "Programming JavaScript Applications",
subtitle: "Robust Web Architecture with Node, HTML5, and Modern JS Libraries",
author: "Eric Elliott",
published: "2014-07-01T00:00:00.000Z",
pages: 14,
},
{
isbn: "9781593277574",
title: "Understanding ECMAScript 6",
subtitle: "The Definitive Guide for JavaScript Developers",
author: "Nicholas C. Zakas",
published: "2016-09-03T00:00:00.000Z",
pages: 32,
},
{
isbn: "9781491904244",
title: "You Don't Know JS",
author: "Kyle Simpson",
published: "2015-12-27T00:00:00.000Z",
pages: 35,
},
{
isbn: "9781449325862",
title: "Git Pocket Guide",
author: "Richard E. Silverman",
published: "2013-08-02T00:00:00.000Z",
pages: 43,
},
{
isbn: "9781449337711",
title: "Designing Evolvable Web APIs with ASP.NET",
author: "Glenn Block, et al.",
published: "2014-04-07T00:00:00.000Z",
pages: 55,
}
]
]

function exibirDados (event){
event.preventDefault();

let author = document.getElementById("nomeDoAutor").value;
let title = document.getElementById("tituloDoLivro").value;
let isbn = document.getElementById("isbnDoLivro").value;
let published = new Date(document.getElementById("dataDaPublicacao").value);
let pages = document.getElementById("numeroDePaginas").value;
let parseDataPublicacao = dataPublicacao.setDate(dataPublicacao.getDate() +1);
console.log(dataPublicacao, parseDataPublicaacao);

if (author === "" || title === "" || isbn === "" || published === "") {
alert("Preencha as informações obrigatórias faltantes") }
else{
books.push({
author: autor,
titulo: titulo,
isbn: isbn,
published: dataDaPublicacao,
pages: paginas
});

function addBooks() {

const resultList = document.getElementById("resposta");

books.forEach((book) => {
const parseDate = new Date(book.published);
const getData = parseDate.toLocaleDateString("pt-br");

resultList.innerHTML += `
<ul>
const parsePaginas = !book.paginas ? "---" : book.paginas;
<li><strong>Autor: </strong> ${book.autor}, <strong>Título: </strong> ${book.titulo}, <strong>Isbn: <strong> ${book.isbn}, <strong>Data da Publicação: </strong>${book.dataPublicacao}, <strong>Páginas: </strong>${book.paginas}
<a href="#" class="delete">Deletar Publicação</a>
</ul>


`


})



}
addBooks();
Loading