// Step 1: Write a function declaration to calculate if a number is odd function isOdd(number){ if (number % 2 === 1) { console.log(`${number} is odd`) } else { console.log(`${number} is even`); } } isOdd(2) // Step 2: Change it to an arrow function: const isOdd = (number) => { return number % 2 === 1 ? console.log(`${number} is odd`) : console.log(`${number} is even`) }; isOdd(29);
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