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 to return parseInt str | |
function originalparseInt(str) { | |
return parseInt(str); | |
} | |
// custom function to return parseInt str | |
function customparseInt(str) { | |
str = str.replace(/\s/g , ''); | |
if( /^[a-z]/i.test(str)){ |
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
let cards = ['J', 10 , 8, 2, 6, 'K', 5, 3, 'Q','A' , 7 , 4 , 9 ]; | |
// change this to match the rules of card game | |
let theRightOrder = ["A", 2, 3, 4, 5, 6, 7, 8, 9, 10, "J", "Q", "K"]; | |
cards.sort((a, b) => theRightOrder.indexOf(a) - theRightOrder.indexOf(b)); | |
console.log(cards); |
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 findSums(arr , num){ | |
let result = [] | |
arr.forEach((n , i) => { | |
if(arr.includes(num - n , i)){ | |
result.push([n , num - n]) | |
} | |
}) | |
return result | |
} |
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 querySelectorIncludesText (selector, text){ | |
return Array.from(document.querySelectorAll(selector)) | |
.find(el => el.textContent.includes(text)); | |
} | |
function stepOne(){ | |
setInterval(async function () { | |
if(step == 1 && document.querySelector('button.display-flex')){ | |
document.querySelector('button.display-flex').click(); | |
step = 2 |