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
### Keybase proof | |
I hereby claim: | |
* I am kevinpy on github. | |
* I am kevinpy (https://keybase.io/kevinpy) on keybase. | |
* I have a public key whose fingerprint is 1C8F 5463 751B 4E35 3BBE 736D BFC3 E7C4 5A53 503C | |
To claim this, I am signing this object: |
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
try { | |
// Do something | |
} | |
catch (error) { | |
const url = `https://stackoverflow.com/search?q=[js]+${error.message}`; | |
window.open(url, '_blank'); | |
} |
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 array = [1, 1, 2, 3, 5, 5, 1] | |
const uniqueArray = [...new Set(array)]; | |
console.log(uniqueArray); // [1, 2, 3, 5] |
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 arr = [ | |
[1, 2, 3], | |
[4, 5, 6], | |
[7, 8, 9] | |
]; | |
const rotate = arr.reduce((value, row) => { | |
return row.map((_, i) => { | |
return [...(value[i] || []), row[i]]; | |
}); |
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
//////////////////////////////////////////////////////////////// | |
/* Combine 2 arrays in Object with key */ | |
//////////////////////////////////////////////////////////////// | |
const arr1 = ['01', '02', '03']; | |
const arr2 = ['10', '20', '30']; | |
let obj = arr1.map((item, i) => { | |
return { | |
arr1: item, | |
arr2: arr2[i] |