• kewko@lemdro.id
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    Mathematician 2 kinda blew my mind, kinda obvious, just can’t believe I was never taught or thought about it.

  • lwhjp@lemmy.sdf.org
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    TDD

    const max12 = (x, y) => {
        if (x === 1 && y === 2) {
            return 2;
        } else if (x === 7 && y === 4) {
            return 7;
        } else {
            return x;
        }
    };
    
  • GTG3000@programming.dev
    link
    fedilink
    Русский
    arrow-up
    1
    ·
    1 year ago

    Why use const max = (x, y) => x > y ? x : y instead of function max(x, y) { return x > y ? x : y } ?