17 Pro JavaScript tricks you didn’t know

<h1>JavaScript : Tricks You Should Know</h1> <h1>The ternary operator</h1> <p>Noobs:</p> <pre> let hungry = true; let eat; if (hungry === true) { eat = &#39;yes&#39;; } else { eat = &#39;no&#39;; }</pre> <p>Pro:</p> <pre> let hungry = true; let eat = hungry === true ? &#39;yes&#39; : &#39;no&#39;;</pre> <p><a href="https://medium.com/javascript-in-plain-english/17-pro-javascript-tricks-you-didnt-know-b419c018dd19"><strong>Read More</strong></a></p>
Tags: JavaScript