Must-know JavaScript array methods
The some()
method tests whether at least one element in the array passes the test implemented by the provided function.
*::before, | |
*::after { | |
box-sizing: border-box; | |
} | |
body, | |
h1, | |
h2, | |
h3, | |
h4, |
input.reduce((accum, item) => { | |
const pos1 = item[0].split('-')[0] - 1 | |
const pos2 = item[0].split('-')[1] - 1 | |
const char = item[1] | |
const password = item[2] | |
if( password.charAt(pos1) === char ^ password.charAt(pos2) === char) { | |
accum++ | |
} |
String.prototype.count = function(char) { | |
return (this.length - this.replace(new RegExp(char,"g"), '').length) / s1.length | |
} | |
input.reduce((accum, item) => { | |
const charMin = item[0].split('-')[0] | |
const charMax = item[0].split('-')[1] | |
const char = item[1] | |
const password = item[2] |
for (let i = 0; i < input.length; i++) { | |
for (let j = 0; j < input.length; j++) { | |
for (let k = 0; k < input.length; k++) { | |
if(input[i] + input[j] + input[k] === 2020) { | |
console.log(`Output: ${input[i] * input[j] * input[k]}`) | |
break | |
} | |
} | |
} | |
} |
for (let i = 0; i < input.length; i++) { | |
for (let j = 0; j < input.length; j++) { | |
if (input[i] + input[j] === 2020) { | |
console.log(`Output: ${input[i]} * ${input[j]} = ${input[i] * input[j]}`) | |
break | |
} | |
} | |
} |
My Awesome Sketch | |
First State | |
some event -> Second State | |
Second State |
Must-know JavaScript array methods
The some()
method tests whether at least one element in the array passes the test implemented by the provided function.
GitHub
AdamMescher/nvte-next
# UTILITY | |
alias uu="brew update && brew upgrade" | |
## Get external IP address | |
alias ip='dig +short myip.opendns.com @resolver1.opendns.com' | |
## Repeat previous command with sudo | |
alias ffs='sudo !!' | |
# List all files | |
alias la="ls -lAF" |
I hereby claim:
To claim this, I am signing this object: