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
(async () => { | |
const promiseA = new Promise((res) => setTimeout(() => res("yes"), 500)); | |
const promiseB = new Promise((_, rej) => setTimeout(() => rej("fail"), 3000)); | |
return await Promise.race([promiseA, promiseB]); | |
})() | |
.then((x) => console.log("val =", x)) | |
.catch((err) => { | |
console.error("error here", err); | |
}); |
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 getDomPath = (element) => { | |
const path = []; | |
let currentElement = element; | |
while (currentElement) { | |
let selector = currentElement.tagName.toLowerCase(); | |
// Add id if it exists | |
if (currentElement.id) { | |
selector += `#${currentElement.id}`; |
OlderNewer