Arrow Functions
Thu Jun 23 2022 23:00:33 GMT+0000 (Coordinated Universal Time)
Saved by
@cruz
#javascript
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"));
content_copyCOPY
Comments