This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const n = (y) => [...Array(y).keys()] | |
const calc = (x) => (acc) => acc *= x | |
const pow = (y, x) => n(y).reduce(calc(x), 1) | |
console.log(`3 ^ 1 = ${pow(1, 3)}`) // 3 | |
console.log(`3 ^ 2 = ${pow(2, 3)}`) // 9 | |
console.log(`3 ^ 3 = ${pow(3, 3)}`) // 27 | |
console.log(`3 ^ 4 = ${pow(4, 3)}`) // 81 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Smartphones (portrait and landscape) ----------- */ | |
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) { | |
/* Styles */ | |
} | |
/* Smartphones (landscape) ----------- */ | |
@media only screen and (min-width: 321px) { | |
/* Styles */ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const groupSame = (acc, el) => { | |
acc[el] | |
? acc[el]++ | |
: acc[el] = 1 | |
return acc | |
} | |
const countDuplicate = (list) => list.reduce(groupSame, {}) | |
const groupMostRepeat = (obj) => Object.keys(obj).reduce((a, b) => obj[a] > obj[b] ? a : b) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const groupSame = (acc, el) => { | |
acc[el] | |
? acc[el]++ | |
: acc[el] = 1 | |
return acc | |
} | |
const groupDuplicate = (list) => list.reduce(groupSame, {}) | |
const findDuplicate = (el) => groupDuplicate([...el]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const arr1 = [1,2,3,4,5,6,7] | |
const arr2 = [1, 3, 5, 7] | |
const filter = (el) => !arr2.includes(el) | |
const filter2 = (el) => arr2.indexOf(el) === -1 | |
const filter3 = (el) => arr2.every(el2 => el2 !== el) | |
const filter4 = (el) => !arr2.some(el2 => el2 === el) | |
console.log(arr1.filter(filter)) | |
console.log(arr1.filter(filter2)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const makeTableAPI = (() => { | |
const makeRows = (data) => { | |
const rows = data.reduce((acc, row) => { | |
acc += ` <tr>\n${makeCols(row)} </tr>\n` | |
return acc | |
}, '') | |
return rows |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Aqui é definido uma função para cada operação matemática | |
Cada função recebe 2 parametros a,b e depois é aplicada a aperação pertinente a cada uma, retornando o valor já calculado | |
*/ | |
const plus = (a = 0 , b = 0) => a + b | |
const times = (a = 0, b = 0) => a * b | |
const minus = (a = 0, b = 0) => a - b | |
const division = (a = 1, b = 1) => a / b | |
/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getService = (type) => { | |
const pres = () => "ppt" | |
const doc = () => "doc" | |
const sheet = () => "sheet" | |
const text = () => "text" | |
const pdf = () => "pdf" | |
const other = () => "default" | |
const service = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const arrObj = [ | |
//Primeiro elemento | |
[ | |
{ | |
"name": "Distri Equipamente Cirurgicos", | |
"data": 18 | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const a = { | |
k1: 1, | |
k2: 2, | |
k3: { | |
k3_1: 3 | |
} | |
} | |
const b = { | |
k1: 1, |