The ES6 Arrow Hub
Easy+25 XP
Mission Briefing
The Guild's sorcerers have adopted a faster, sleeker way of casting spells. You must upgrade your function syntax to meet the modern standard to determine if a number is even.
The Concept: Arrow Functions
Modern JavaScript introduced a shorter way to write functions called Arrow Functions. They use the => syntax and are the standard for professional development today.
Example: const add = (a, b) => a + b; (This is an implicit return!)
The Objective
Your mission is to write an arrow function called checkEven that receives a number num.
- Use arrow function syntax (
() => {}). - Use the modulo operator (
%) to check if the number is perfectly divisible by 2. - Return
trueif the number is even, andfalseif it is odd.
01EXAMPLE 1
Input
num = 10Output
true02EXAMPLE 2
Input
num = 7Output
falseConstraints
- Use arrow function syntax.
FundamentalsES6+Functions
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
num10
Expected Output
true
Click RUN to test your solution