Snippets Collections
function validateString(str) {
  return str && str.trim().length > 5 ? str : null;
}
 function direction(item) {
    const increment =
      item.classList[1] === "decrease"
        ? counter--
        : item.classList[1] === "increase"
        ? counter++
        : item.classList[1] === "reset"
        ? (counter = 0)
        : counter; 

    return increment;
  }
const calcTip = (bill) => {
  return bill >= 50 && bill <= 300 ? bill * 0.15 : bill * 0.20;
}
// if something is true then execute the code on the left, otherwise return null
e.propertyName === 'transform' ? key.classList.remove('playing') : null;
star

Sun Jul 28 2024 23:43:44 GMT+0000 (Coordinated Universal Time)

#function #ternary
star

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

#ternary #nested #function
star

Wed Jun 12 2024 06:23:57 GMT+0000 (Coordinated Universal Time)

#condtional #ternary
star

Wed Apr 03 2024 23:46:07 GMT+0000 (Coordinated Universal Time)

#javascript #ternary

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension