6 kyu

Custom Setters and Getters

1,098 of 1,122bkimmel
Description
Loading description...
Fundamentals
Object-oriented Programming
  • Please sign in or sign up to leave a comment.
  • farhanaditya Avatar

    Node v12 should be used enabled along with its appropiate assertion tools (Mocha + Chai).

  • farhanaditya Avatar

    No random test

  • FArekkusu Avatar

    No sample tests.

  • hksong Avatar

    Kind of weird having getters and setters for temperature, but not for archive...

  • ikhsanalatsary Avatar

    i get stuck here

  • wadewang Avatar

    help a lot to me

  • trike Avatar

    I can't understand why the 5th test fail with "TypeError: Cannot redefine property: temperature". Spend time googling but with no result.

  • infolock Avatar

    This seems silly to me. My code works just fine when I run it. When I run it against the tests, I get the following: Changed temp 3 times, expected this.getArchive to return 3 items. Got 2

    This is after adding JSON.stringify to the result of getArchive. If I don't use JSON.stringify, it complains that it expected 3 items, but got 0.

    console, though, when executing there, returns all 3 objects just fine

  • rmngrc Avatar

    This comment has been hidden.

  • apparatus Avatar

    Maybe I've missed something, but why are there no sample tests? I don't quite get how to test if the archive getter results are valid.

  • wainage Avatar

    This comment has been hidden.

  • yohosuff Avatar

    This comment has been hidden.

  • samzer Avatar

    Assigning a getter should be mentioned in the instructions otherwise one can get stuck if (s)he has implemented the code correctly

  • congyoubing2000 Avatar

    Hi, when I submited my solution, I got first 3 tests passed, but failed at 4th. What is 4th test?

  • aaronallport Avatar

    Hi, is there an issue with one of the tests? The test that changes the temperature 4 times is saying my code returns 7 entries, yet I cannot re-produce this myself. If I change the temperature 4 times in my console I get 4 entries in the Archive...

  • petr Avatar

    Why do I get the stack_overflow error when i try to run my code?

    stack_overflow: Maximum call stack size exceeded

  • adouglas Avatar

    The instructions don't say anything about requiring a getter for temperature. But one is required in order to submit successfully.

  • jhoffner Avatar

    Is there value in having the someRandomProperty example? It seems to create noise when understanding the requirements, without having any purpose for being there. Other than that it seems like this is about ready to come out of beta.

  • bkimmel Avatar

    Discussion topic: Now that you've made it through the kata and you know how the custom getters/setters work, what do you think about their use in practice? I've heard some people say that they belong in JS's "evil" basket along with eval() ... and other people use them frequently. Browser support for these is "uneven" at best, as I understand it... One drawback that I've heard of is that they really hit your performance hard.. on the other hand, being able to "tuck" functions into normal object reads and writes gives you the power to do some interesting things like we did in the kata that would otherwise not be possible in JS...