The browser doesn’t observe classic PEMDAS. It’s running PE(MD)(AS). Which means 4878 has a solution NOT in the tests… (4-8+7)*8.
If addition has no priority over subtraction 4-8 = -4, -4 + 7 = 3, 3 * 8 = 24. Unless you expect students to additionally implement a subroutine to evaluate strings via classic PEMDAS, you need to update the tests.
All valid solution codes should use PEMDAS, that is the default evaluation for nearly every programming language. Allthough the test page does not list all 10 valid result strings, it does check for them.
Didn’t see it fail, and in the end it didn’t. I just saw it coming back in a console.log() before running the test suite, but seeing the list to the left that said it must match one of two expressions.
"solve24("4878") should return (7-8/8)*4 or 4*(7-8/8)" doesn’t leave room for more possibilities. It could be worded better.