Hi,
Is there any other requirements for this kata like if it has to be a object literal notation or constructor type as am keep getting message like "expected 4 but got NaN", but my code is working correctly in other interpreter but not in codewars!!?
uhm, you're making a new Calculator variable and you set it equal to your constructor... it's supposed to be something like var myCalc = new Calculator(); and then you can call it as myCalc.add(1,2); and so on. Also on your divide function, you re checking both variables to see if they're zero. That's mathematically not correct. In a/b , a can be very well 0, the result will be zero.
So yea, I kept failing and couldn't figure out for the life of me. So I forfeited and every single solution I've plugged in so far has failed as well. Not a good experience for my first attempt lol.
Reopened as an issue.
No random tests
let / const
to redefine itNeed more tests. I made the wrong task. "Attempt" worked.
I don't know how to write this test, please help me!
same here. it kept failing and then i looked at the tests and they were missing.
Nice ;) I had lots of fun refactoring my code !
Test cases could have included more fixed tests and especially random tests - keep that in mind when authoring future Kata :)
Do you mean an Unknown Error?
As suggested in wiki, try using submit instead of run tests, and refreshing the page.
I created a fiddle with some tests and they all work, but when I post the code here it returns and undefined error.
Hi,
Is there any other requirements for this kata like if it has to be a object literal notation or constructor type as am keep getting message like "expected 4 but got NaN", but my code is working correctly in other interpreter but not in codewars!!?
I kept getting 'unknown error' despite my code being legit. I didn't realize that you need to create your own test cases.
I think you should clarify a bit more whether edge cases should be checked or not - for example if someone doesn't insert a number and so on..
uhm, you're making a new Calculator variable and you set it equal to your constructor... it's supposed to be something like var myCalc = new Calculator(); and then you can call it as myCalc.add(1,2); and so on. Also on your divide function, you re checking both variables to see if they're zero. That's mathematically not correct. In a/b , a can be very well 0, the result will be zero.
So yea, I kept failing and couldn't figure out for the life of me. So I forfeited and every single solution I've plugged in so far has failed as well. Not a good experience for my first attempt lol.
Loading more items...