Handshake

in #ita2 days ago

let arr : string[] =["wink" ,"double blink","close your eyes", "jump"];

export function commands(num: number): string[] {

let res: string[] = [];

const binArr = num.toString(2).padStart(5, "0").split("").reverse(); // padStart garantisce la presenza di 5 digits aggiungendo 0 se necessario!

for(let i=0; i<4; i++){

if(binArr[i] === "1") res.push(arr[i]);

}

return binArr[4] === "1"? res.reverse(): res;

}

Sort:  

Thank you for your witness vote!
Have a !BEER on me!
To Opt-Out of my witness beer program just comment STOP below


Hey @drago18121996, here is a little bit of BEER from @isnochys for you. Enjoy it!

Learn how to earn FREE BEER each day by staking your BEER.