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
// --------------------------------------------- | |
// Number | |
// --------------------------------------------- | |
const amount = 1234567.89; | |
const priceFR = new Intl.NumberFormat( | |
"fr-FR", | |
{ | |
style: "currency", |
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
blueprint: | |
name: Zigbee2MQTT - Tuya 2-Button Scene Switch Push_LO | |
description: Automate your Tuya 2-Button Scene Switch (Push_LO) via Zigbee2MQTT. | |
domain: automation | |
input: | |
switch: | |
name: Push_LO Switch | |
description: Tuya 2-Button Scene Switch to use | |
selector: | |
entity: |
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
try { | |
// Do something | |
} | |
catch (error) { | |
const url = `https://stackoverflow.com/search?q=[js]+${error.message}`; | |
window.open(url, '_blank'); | |
} |
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 array = [1, 1, 2, 3, 5, 5, 1] | |
const uniqueArray = [...new Set(array)]; | |
console.log(uniqueArray); // [1, 2, 3, 5] |
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 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 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
//////////////////////////////////////////////////////////////// | |
/* 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] |