diff --git a/Exercicios/10. array.map()/script2.js b/Exercicios/10. array.map()/script2.js new file mode 100644 index 0000000..4f44ba7 --- /dev/null +++ b/Exercicios/10. array.map()/script2.js @@ -0,0 +1,20 @@ +const winners = [ + { + nome: 'Equipe Maravilinda', + pais: 'Canadá', + }, + { + nome: 'Liga da Justiça', + pais: 'EUA', + }, + { + nome: 'Mega Grupo', + pais: 'Brasil', + }, +]; + +const vencedores = winners.map((equipe) => { + return equipe.nome; +}); + +console.log(vencedores); \ No newline at end of file diff --git a/Exercicios/11. array.forEach()/script.js b/Exercicios/11. array.forEach()/script.js index 9c1e191..a372bfa 100644 --- a/Exercicios/11. array.forEach()/script.js +++ b/Exercicios/11. array.forEach()/script.js @@ -1 +1,8 @@ const numbers = [65, 44, 12, 4, 68]; +let sum = 0; + +numbers.forEach((numero) => { + sum += numero; +}) + +console.log(sum); \ No newline at end of file diff --git a/Exercicios/2. for/script.js b/Exercicios/2. for/script.js index 557d6fc..95911ca 100644 --- a/Exercicios/2. for/script.js +++ b/Exercicios/2. for/script.js @@ -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]); +} \ No newline at end of file diff --git a/Exercicios/4. array.push()/script.js b/Exercicios/4. array.push()/script.js index db2e01a..15c322f 100644 --- a/Exercicios/4. array.push()/script.js +++ b/Exercicios/4. array.push()/script.js @@ -1 +1,5 @@ -const listagemDeFrutas = [ "Uva", "Banana", "Manga", "Cajá", "Pinha", "Maçã", "Melão"]; \ No newline at end of file +const listagemDeFrutas = [ "Uva", "Banana", "Manga", "Cajá", "Pinha", "Maçã", "Melão"]; + +listagemDeFrutas.push('abacate', 'melancia', 'morango' ) + +console.log(listagemDeFrutas); \ No newline at end of file diff --git a/Exercicios/5. array.pop()/script.js b/Exercicios/5. array.pop()/script.js index b6f649a..b157d6d 100644 --- a/Exercicios/5. array.pop()/script.js +++ b/Exercicios/5. array.pop()/script.js @@ -1,5 +1,8 @@ const listagemDeFrutas = [ "Uva", "Banana", "Manga", "Cajá", "Pinha", "Maçã", "Melão"]; +const ultimoElementoListagem = listagemDeFrutas.pop(); +//console.log(listagemDeFrutas) + const usuarios = [ {user:234, name: 'Marcia', idade:40 }, {user:235, name: 'Lorena', idade:20 }, @@ -7,4 +10,9 @@ const usuarios = [ {user:237, name: 'Mariana', idade:15 }, {user:238, name: 'Isis', idade:34 }, {user:239, name: 'Pietra', idade:23 } -] \ No newline at end of file +] +const removeUsuario = usuarios.pop(); +console.log(removeUsuario) + +//console.log(usuarios.pop()); + diff --git a/Exercicios/6. array.shift()/script.js b/Exercicios/6. array.shift()/script.js index b6f649a..dfd61f3 100644 --- a/Exercicios/6. array.shift()/script.js +++ b/Exercicios/6. array.shift()/script.js @@ -1,5 +1,8 @@ const listagemDeFrutas = [ "Uva", "Banana", "Manga", "Cajá", "Pinha", "Maçã", "Melão"]; +listagemDeFrutas.shift(); +//console.log(listagemDeFrutas) + const usuarios = [ {user:234, name: 'Marcia', idade:40 }, {user:235, name: 'Lorena', idade:20 }, @@ -7,4 +10,8 @@ const usuarios = [ {user:237, name: 'Mariana', idade:15 }, {user:238, name: 'Isis', idade:34 }, {user:239, name: 'Pietra', idade:23 } -] \ No newline at end of file +] + +usuarios.shift(); +console.log(usuarios); + diff --git a/Exercicios/7. array.unshift()/script.js b/Exercicios/7. array.unshift()/script.js index 8421f62..5f611ca 100644 --- a/Exercicios/7. array.unshift()/script.js +++ b/Exercicios/7. array.unshift()/script.js @@ -1,4 +1,8 @@ const listagemDeFrutas = [ "Uva", "Banana", "Manga", "Cajá", "Pinha", "Maçã", "Melão"]; + +listagemDeFrutas.unshift('morango') +//console.log(listagemDeFrutas) + const usuarios = [ {user:234, name: 'Marcia', idade:40 }, {user:235, name: 'Lorena', idade:20 }, @@ -6,4 +10,13 @@ const usuarios = [ {user:237, name: 'Mariana', idade:15 }, {user:238, name: 'Isis', idade:34 }, {user:239, name: 'Pietra', idade:23 } -] \ No newline at end of file +] + +usuarios.unshift( + { + user: 233, + name: 'talita', + idade: 26, +} +) +console.log(usuarios) \ No newline at end of file diff --git a/Exercicios/8. array.slice()/script.js b/Exercicios/8. array.slice()/script.js index 8421f62..ac6af13 100644 --- a/Exercicios/8. array.slice()/script.js +++ b/Exercicios/8. array.slice()/script.js @@ -1,4 +1,8 @@ const listagemDeFrutas = [ "Uva", "Banana", "Manga", "Cajá", "Pinha", "Maçã", "Melão"]; + +const selesctorItens = listagemDeFrutas.slice(2,6); +//console.log(selesctorItens) + const usuarios = [ {user:234, name: 'Marcia', idade:40 }, {user:235, name: 'Lorena', idade:20 }, @@ -6,4 +10,7 @@ const usuarios = [ {user:237, name: 'Mariana', idade:15 }, {user:238, name: 'Isis', idade:34 }, {user:239, name: 'Pietra', idade:23 } -] \ No newline at end of file +] + +const selectedItens = usuarios.slice(2,6); +console.log(selectedItens) \ No newline at end of file diff --git a/Exercicios/9. array.splice()/script.js b/Exercicios/9. array.splice()/script.js index 08107fd..5a808ae 100644 --- a/Exercicios/9. array.splice()/script.js +++ b/Exercicios/9. array.splice()/script.js @@ -1,4 +1,8 @@ const countryList = [ "Argentina","Armenia","Australia","Azerbaijan","Bahamas","Brazil","Burkina Faso", "Costa Rica","Mauritania","St Vincent","Uganda","United Arab Emirates","Uruguay","Uzbekistan","Venezuela"]; + +countryList.splice(0, 2, 'Fortaleza', 'Caucaia' ) +console.log(countryList) + const usuarios = [ {user:234, name: 'Marcia', idade:40 }, {user:235, name: 'Lorena', idade:20 }, @@ -6,4 +10,7 @@ const usuarios = [ {user:237, name: 'Mariana', idade:15 }, {user:238, name: 'Isis', idade:34 }, {user:239, name: 'Pietra', idade:23 } -] \ No newline at end of file +] + +usuarios.splice(0, 3, 'talita') +//console.log(usuarios) \ No newline at end of file diff --git "a/Exerc\303\255cio de Casa/imagem/astronauta-esta-lendo-um-livro-cinza.jpg" "b/Exerc\303\255cio de Casa/imagem/astronauta-esta-lendo-um-livro-cinza.jpg" new file mode 100644 index 0000000..a226f7e Binary files /dev/null and "b/Exerc\303\255cio de Casa/imagem/astronauta-esta-lendo-um-livro-cinza.jpg" differ diff --git "a/Exerc\303\255cio de Casa/imagem/astronauta-lendo-livro.jpg" "b/Exerc\303\255cio de Casa/imagem/astronauta-lendo-livro.jpg" new file mode 100644 index 0000000..71328c7 Binary files /dev/null and "b/Exerc\303\255cio de Casa/imagem/astronauta-lendo-livro.jpg" differ diff --git "a/Exerc\303\255cio de Casa/imagem/livro-com-astronautas-e-sistema-solar_.jpg" "b/Exerc\303\255cio de Casa/imagem/livro-com-astronautas-e-sistema-solar_.jpg" new file mode 100644 index 0000000..64e5b58 Binary files /dev/null and "b/Exerc\303\255cio de Casa/imagem/livro-com-astronautas-e-sistema-solar_.jpg" differ diff --git "a/Exerc\303\255cio de Casa/imagem/livro-com-astronautas-e-sistema-solar_pequeno.png" "b/Exerc\303\255cio de Casa/imagem/livro-com-astronautas-e-sistema-solar_pequeno.png" new file mode 100644 index 0000000..6d74341 Binary files /dev/null and "b/Exerc\303\255cio de Casa/imagem/livro-com-astronautas-e-sistema-solar_pequeno.png" differ diff --git "a/Exerc\303\255cio de Casa/index.html" "b/Exerc\303\255cio de Casa/index.html" index e69de29..74b9c08 100644 --- "a/Exerc\303\255cio de Casa/index.html" +++ "b/Exerc\303\255cio de Casa/index.html" @@ -0,0 +1,98 @@ + + + + + + + PlanetBooks + + + + + + + + +

PlanetBooks

+ +
+
+

Cadastrar Livro

+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
+
+ +
+ +
+ + +
+ +
+

Livros Cadastrados

+ + + + + + + + + + + + +
TítuloAutorISBN#Data de PublicaçãoPáginasIdioma
+
+
+ + + + + diff --git "a/Exerc\303\255cio de Casa/script/books.js" "b/Exerc\303\255cio de Casa/script/books.js" new file mode 100644 index 0000000..68f1d0b --- /dev/null +++ "b/Exerc\303\255cio de Casa/script/books.js" @@ -0,0 +1,55 @@ +let books = [ + { + isbn: "9781593275846", + title: "Eloquent JavaScript, Second Edition", + subtitle: "A Modern Introduction to Programming", + author: "Marijn Haverbeke", + published: "2014-12-14T00:00:00.000Z", + }, + { + 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", + }, + { + isbn: "9781449365035", + title: "Speaking JavaScript", + subtitle: "An In-Depth Guide for Programmers", + author: "Axel Rauschmayer", + published: "2014-02-01T00:00:00.000Z", + }, + { + 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", + }, + { + isbn: "9781593277574", + title: "Understanding ECMAScript 6", + subtitle: "The Definitive Guide for JavaScript Developers", + author: "Nicholas C. Zakas", + published: "2016-09-03T00:00:00.000Z", + }, + { + isbn: "9781491904244", + title: "You Don't Know JS", + author: "Kyle Simpson", + published: "2015-12-27T00:00:00.000Z", + }, + { + isbn: "9781449325862", + title: "Git Pocket Guide", + author: "Richard E. Silverman", + published: "2013-08-02T00:00:00.000Z", + }, + { + isbn: "9781449337711", + title: "Designing Evolvable Web APIs with ASP.NET", + author: "Glenn Block, et al.", + published: "2014-04-07T00:00:00.000Z", + } +] \ No newline at end of file diff --git "a/Exerc\303\255cio de Casa/script/script.js" "b/Exerc\303\255cio de Casa/script/script.js" index 68f1d0b..635e5b3 100644 --- "a/Exerc\303\255cio de Casa/script/script.js" +++ "b/Exerc\303\255cio de Casa/script/script.js" @@ -1,55 +1,63 @@ -let books = [ - { - isbn: "9781593275846", - title: "Eloquent JavaScript, Second Edition", - subtitle: "A Modern Introduction to Programming", - author: "Marijn Haverbeke", - published: "2014-12-14T00:00:00.000Z", - }, - { - 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", - }, - { - isbn: "9781449365035", - title: "Speaking JavaScript", - subtitle: "An In-Depth Guide for Programmers", - author: "Axel Rauschmayer", - published: "2014-02-01T00:00:00.000Z", - }, - { - 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", - }, - { - isbn: "9781593277574", - title: "Understanding ECMAScript 6", - subtitle: "The Definitive Guide for JavaScript Developers", - author: "Nicholas C. Zakas", - published: "2016-09-03T00:00:00.000Z", - }, - { - isbn: "9781491904244", - title: "You Don't Know JS", - author: "Kyle Simpson", - published: "2015-12-27T00:00:00.000Z", - }, - { - isbn: "9781449325862", - title: "Git Pocket Guide", - author: "Richard E. Silverman", - published: "2013-08-02T00:00:00.000Z", - }, - { - isbn: "9781449337711", - title: "Designing Evolvable Web APIs with ASP.NET", - author: "Glenn Block, et al.", - published: "2014-04-07T00:00:00.000Z", +const titulo = document.querySelector("#titulo"); +const autor = document.querySelector("#autor"); +const isbn = document.querySelector("#isbn"); +const dataPub = document.querySelector("#dataPub"); +const paginas = document.querySelector("#paginas"); +const idioma = document.querySelector("#idioma"); +const submit = document.querySelector("#submeterForm"); +const tabela = document.querySelector("#tabela"); +const formatter = new Intl.DateTimeFormat('pt-BR') + +for (let index = 0; index < books.length; index++) { + inserirLivo(books[index]); +} + +submit.addEventListener("click", function (e) { + e.preventDefault() + + if (titulo.value == '' || autor.value =='' || isbn.value == '' + || dataPub.value == '' || paginas.value == '' || idioma.value == '' ) { + alert('Preencha todos os campos.') + return } -] \ No newline at end of file + + const livro = { + title: titulo.value, + author: autor.value, + isbn: isbn.value, + published: dataPub.value, + pages: paginas.value, + dataInserc: Date(), + idioma: idioma.value + } + + books.push(livro) + + inserirLivo(livro) + alert('Item adicionado com sucesso.') +}) + +function inserirLivo(livro) { + let tr = document.createElement("tr"); + tr.innerHTML = ` + ${livro.title} + ${livro.author} + ${livro.isbn} + ${formatter.format(new Date(livro.published.split('.')[0]))} + ${livro.pages || '-'} + ${livro.idioma || "-"} + + + + ` + + tabela.appendChild(tr); +} + +function removerItem(item) { + item.parentNode.parentNode.remove() + +} + diff --git "a/Exerc\303\255cio de Casa/style/style.css" "b/Exerc\303\255cio de Casa/style/style.css" index e69de29..e1c2484 100644 --- "a/Exerc\303\255cio de Casa/style/style.css" +++ "b/Exerc\303\255cio de Casa/style/style.css" @@ -0,0 +1,95 @@ +body { + background-image: url(../imagem/astronauta-esta-lendo-um-livro-cinza.jpg); + background-size: cover; + background-repeat: no-repeat; + font-family: 'IBM Plex Sans', sans-serif ; +} +.container { + width: 100%; + max-width: 960px; + margin: 0 auto; + color: white; + padding-bottom: 20px; +} + +.tabela { + text-align: center; + width: 100%; + border-collapse: collapse; + background-color: rgb(243, 205, 243); + color: black; + +} + +.tabela thead th { + color: rgb(97, 22, 167); + padding: 0 5px; +} + +.tabela td { + padding: 10px; +} +.tabela tr:nth-child(even) { + background: rgb(233, 231, 231); +} + +.planetalivros { + font-style: oblique; + text-align: center; + color: black; + letter-spacing: 5px; +} + +.botao { + margin: 2% auto; + padding: 10px 25px; + text-transform: uppercase; + border: none; + border-radius: 3px; + color: black; + font-weight: bolder; +} + +.btn { + background-color: transparent; + border: none; + border-radius: 3px; +} + +.livrocad { + color: black; +} + +.dados { + margin-top: 1%; +} + +.form { + /* background-color: rgba(0, 0, 0, 0.4); */ + display: block; + padding: 15px; + color: black; +} + +.input { + height: 20px; + border-radius: 5px; + width: 30%; +} + +.btn-danger { + background-color: rgb(238, 93, 93); +} + +.btn-success { + background-color: lightgreen; +} + +.text-white { + color: white; +} + +.icon { + font-size: large; + +}