Use modulus:
// Will evaluate to true if the variable is divisible by 2
variable % 2 === 0
More Related Contents:
- Modulo operator
- JavaScript % (modulo) gives a negative result for negative numbers
- How to perform an integer division, and separately get the remainder, in JavaScript?
- What do multiple arrow functions mean in JavaScript?
- How do I promisify native XHR?
- MongoDB, remove object from array
- Get the values from the “GET” parameters (JavaScript) [duplicate]
- How to find first element of array matching a boolean condition in JavaScript?
- How to destructure object properties with key names that are invalid variable names?
- How to convert string into float in JavaScript?
- jQuery difference between change and click event of checkbox
- How to sort an associative array by its values in Javascript?
- How to reset the bootstrap modal when it gets closed and open it fresh again?
- React react-router-dom pass props to component
- Calculate the date yesterday in JavaScript
- Function declaration in block moving temporary value outside of block?
- Python library for rendering HTML and javascript [closed]
- Assign multiple variables to the same value in Javascript?
- Is there a decimal math library for JavaScript?
- How to hide navbar in login page in react router
- Highcharts – issue about full chart width
- How to set prefixed CSS3 transitions using JavaScript?
- Can I use Javascript to get the compass heading for iOS and Android?
- How do display a collapsible tree in AngularJS + Bootstrap
- Wait for forEach with a promise inside to finish
- How do you limit options selected in a html select box?
- Calling Javascript using UIWebView
- How to simplify a decimal into the smallest possible fraction?
- Trigger $document.ready (so AJAX code I can’t modify is executed)
- How do I list all Members with a Role In Discord.Js