Using Ternary Operator
a == b ? console.log("Match!") : console.log("No match!");
if condition a
equals b
is true, then do one thing, else do something else. The Ternary Operator makes this into a single line of code for us where it says the condition, question mark, the true statement, colon, the false statement.
So, if a
equals b
is true, then console log match. Otherwise, console log no match.