This file contains 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 scrolledDown = window.scrollY + window.innerHeight; |
This file contains 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
h1 { | |
display: grid; | |
grid-template-columns: 1fr auto 1fr; | |
gap: 1em; | |
} | |
h1::before, | |
h1::after { | |
content: ""; | |
border-top: 0.1em double black; | |
align-self: center; |
This file contains 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 namesOfPeople = [ | |
"Dan", | |
"Hannah", | |
"Cameron", | |
"Nash", | |
"Dan", | |
"Hannah", | |
"Cameron", | |
"Nash", | |
"Dan", |
This file contains 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
var groupedData = [ | |
[1, 2, 3], | |
[4, 5, 6], | |
[7, 8, 9], | |
[10, 11, 12], | |
]; | |
var flattedData = groupedData.reduce((prev, curr) => { | |
return prev.concat(curr); | |
}); |
This file contains 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 newData = [1, 4, 5, 6, 7, 8, 9, 10]; | |
const meanValue = newData.reduce((prev, curr, index, array) => { | |
const intermediate = prev + curr; | |
if (index === array.length - 1) { | |
return intermediate / array.length; | |
} | |
return intermediate; | |
}, 0); |
This file contains 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
plugin(function ({ addVariant }) { | |
addVariant("initial", "html :where(&)"); | |
}), |
This file contains 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 localesList = ["fr", "da", "de", "es", "it", "nl", "en"] as const | |
type Translations = { | |
fr: string; | |
da: string; | |
de: string; | |
es: string; | |
it: string; | |
nl: string; | |
en: string; |
This file contains 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
function callAll(...fns) { | |
return (...args) => { | |
fns.forEach(fn => { | |
fn && fn(...args) | |
}) | |
} | |
} |
This file contains 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 numbers = [1, 2, 2, 4, 8, 9, 10 , 12, 14, 18 , 10, 4, 1]; | |
const sortedollection = [... new Set(numbers)]; | |
console.log(sortedollection) |
This file contains 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 testArray = 100; | |
console.log([...Array(testArray).keys()]) |
NewerOlder