nested ternary with function

PHOTO EMBED

Sat Jul 13 2024 22:19:01 GMT+0000 (Coordinated Universal Time)

Saved by @davidmchale #ternary #nested #function

 function direction(item) {
    const increment =
      item.classList[1] === "decrease"
        ? counter--
        : item.classList[1] === "increase"
        ? counter++
        : item.classList[1] === "reset"
        ? (counter = 0)
        : counter; 

    return increment;
  }
content_copyCOPY