const plantNeedsWater = (day) => {
if (day === 'Wednesday') {
return true;
} else {
return false;
}
};
//the above function can be refactored to this since it has only one parameter
const plantNeedsWater = day => day === 'Wednesday' ? true : false;
console.log(plantNeedsWater("Tuesday"));
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter