How to check if a number is even in javascript

To check if a number is even in javascript you can use the following snippet.

Sample Javascript

function NumberIsEven(input) {
	if (input % 2 == 0)
		return true;
	else
		return false;
}

4 thoughts on “How to check if a number is even in javascript

Leave a Reply