Skip to content

Commit 0af2729

Browse files
committed
commit
1 parent 13a8875 commit 0af2729

File tree

5 files changed

+69
-25
lines changed

5 files changed

+69
-25
lines changed

.idea/vcs.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

Lines changed: 21 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

09-Data-Structures-Operators/.idea/vcs.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
Let's continue with our football betting app! This time, we have a map with a log of the events that happened during the game. The values are the events themselves, and the keys are the minutes in which each event happened (a football game has 90 minutes plus some extra time).
3+
4+
1. Create an array 'events' of the different game events that happened (no duplicates)
5+
2. After the game has finished, is was found that the yellow card from minute 64 was unfair. So remove this event from the game events log.
6+
3. Print the following string to the console: "An event happened, on average, every 9 minutes" (keep in mind that a game has 90 minutes)
7+
4. Loop over the events and log them to the console, marking whether it's in the first half or second half (after 45 min) of the game, like this:
8+
[FIRST HALF] 17: ⚽️ GOAL*/

09-Data-Structures-Operators/starter/script.js

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,36 +67,67 @@ console.log(data)*/
6767

6868
/*The spread operator(...)*/
6969
const listaCompras = ['açucar', 'ovo', 'farinha', 'creme dental', 'feijão'];
70-
console.log(listaCompras);
70+
/*console.log(listaCompras);*/
7171
/*Copia de array com o operador spread*/
7272
const novoArray = [...listaCompras];
73-
console.log(novoArray);
73+
/*console.log(novoArray);*/
7474
/*Juntando dois arrays*/
7575
const listaComprasDois = ['pasta de amendoin','nutella'];
7676
const compras = [...listaCompras, ...listaComprasDois];
77-
console.log(compras);
77+
/*console.log(compras);*/
7878

7979
/*Iterables: arrays, strings, maps, sets, nodlist*/
8080
const str = 'Genildo';
8181
const letras = [...str, ' ', 'Souza'];
82-
console.log(letras, ...letras)
82+
/*console.log(letras, ...letras)*/
8383

8484
/*Varios argumentos para uma função*/
8585
const listaPlanos = ['Plano +', 'Plano ++', 'Plano star'];
8686

8787
const planos = function (plan1, plan2, plan3){
88-
console.log(`Os planos disponiveis são ${plan1}, ${plan2}, ${plan3}.`)
88+
/*console.log(`Os planos disponiveis são ${plan1}, ${plan2}, ${plan3}.`)*/
8989
}
9090
planos(listaPlanos[0],listaPlanos[1],listaPlanos[2])
9191
planos(...listaPlanos)
9292

9393
/**/
9494
const add = function (...names){
9595
for (const items of names){
96-
console.log(items)
96+
// console.log(items)
9797
}
9898
}
9999

100100
add('Marcos', 'Maria')
101101
add('s','q','a','d')
102-
/**************************/
102+
/**************************/
103+
/*console.log(3 || 'not')
104+
console.log(true || 0)*/
105+
106+
const restaurant = {
107+
pizzas: ['Mussarela', 'Calabresa', 'Palmito'],
108+
bebidas : 0,
109+
doces : ['paçoca', 'halls', 'bala 7belo']
110+
}
111+
112+
// Nullish : null and undefined
113+
restaurant.reserva = 0;
114+
const reservas = restaurant.reserva ?? 10;
115+
if (!0 ?? 10){
116+
/*console.log('S')*/
117+
}
118+
119+
/*Logical assignment operatos*/
120+
const rest1 = {
121+
name: 'La mama',
122+
lugaresDisponiveis: 10,
123+
}
124+
125+
const rest2 = {
126+
name: 'Mama mia',
127+
dono: 'Santiago',
128+
}
129+
130+
rest1.lugaresDisponiveis ||= 10;
131+
rest2.lugaresDisponiveis = rest2.lugaresDisponiveis || 10;
132+
console.log(rest1);
133+
console.log(rest2);

0 commit comments

Comments
 (0)