Wed Jun 12 2024 06:23:57 GMT+0000 (Coordinated Universal Time)
Saved by @davidmchale #condtional #ternary
const calcTip = (bill) => { return bill >= 50 && bill <= 300 ? bill * 0.15 : bill * 0.20; }
#condtional #ternary
#javascript #ternary
// if something is true then execute the code on the left, otherwise return null e.propertyName === 'transform' ? key.classList.remove('playing') : null;
#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; }
#function #ternary
function validateString(str) { return str && str.trim().length > 5 ? str : null; }
Copy this HTML code:
Preview:
open_in_newInstructions on embedding in Medium
Comments