isEven

Easy · Conditionals · 2 test cases

Given a number, return true if it is even, otherwise return false.

Examples

isEven(4) → true
isEven(7) → false

Starter code

function isEven(num) {

}

Complexity of the optimal solution

Time O(1), space O(1). The modulo operator (%) is a single, constant-time arithmetic operation. The function's execution time is not dependent on the magnitude of the input number.

Solve isEven in the browser