Use Object.defineProperty to write custom setters and getters
This might have been the (only solution?) norm when this kata was created, but now that JavaScript has a proper class syntax with getters and setters, forbidding the use of modern language features is ridiculous.
I've imlement this method (all test are passed). What does this test check? method typeof?? If yes, my code also passed sample tests, which are check method typeof too
if you use function expression for that method you have to remember about hoisting
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
It won't work with 'class' syntax for some reason.
You have to use the approach shown here: https://www.youtube.com/watch?v=gdjfsDlkH7A
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Add one more test - set
felix.weight
second time and check average. This will surely show some broken solutions.This might have been the (only solution?) norm when this kata was created, but now that JavaScript has a proper class syntax with getters and setters, forbidding the use of modern language features is ridiculous.
If anybody's interested:
Nobody's going to change it now.
Why is there a
Cat
hidden in preloaded?This comment is hidden because it contains spoiler information about the solution
I've imlement this method (all test are passed). What does this test check? method typeof?? If yes, my code also passed sample tests, which are check method typeof too
seems pretty clear, doesn't it? :o
you have to define that
averageWeight
method, where appropriate for the current task.Loading more items...