← Back to challenges

Valid Division

JavaScriptHardmathvalidation

Instructions

Create a function that takes a division equation d and checks if it will return a whole number without decimals after dividing.

Examples

validDivision("6/3") ➞ true

validDivision("30/25") ➞ false

validDivision("0/3") ➞ true

Notes

Return "invalid" if division by zero.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Find the Second Occurrence of "zip" in a String