How do I figure out if a variable is divisible by 2? Furthermore I need do a function if it is and do a different function if it is not.
Use modulus:
// Will evaluate to true if the variable is divisible by 2 variable % 2 === 0
1.4m articles
1.4m replys
5 comments
57.0k users