DEV Community

Discussion on: Roast the code #1 | Rock Paper Scissors

 
nombrekeff profile image
Keff

Makes sense, in this case it might've been interesting to create a tuple type for the rules/conditions, and then just write a function to compare them, as you know they will only have 2 values (at least for the example provided) something like:

const areTuplesEqual = (t1: Tuple, t2: Tuple) => {
    return t1[0] === t2[0] && t1[1] === t2[1];
}
Enter fullscreen mode Exit fullscreen mode

I'm glad you're enjoying it! It's cool that you could take something away from it too!