We are all familiar with the Logical OR Operator (||). One of the most common uses of the OR operator is to compare one value to several other values in a condition. Let's look at an example:Write a function that takes the name of a month as an argum...

Markdown supported · ⌘↵ to post
Tanner Wiltshire
You can also use
Array.includes():function checkMonth (month) { const compareMonths = ['January', 'March', 'May', 'July', 'August', 'October', 'December']; // we can use ternary instead of if ...else return compareMonths.includes(month) ? `${month} has 31 days` : `${month} doesn't have 31 days`; } console.log(checkMonth ('July')); // "July has 31 days" console. log (checkMonth ('February')) // "February doesn't have 31 days"