• Sign Up
    Time to claim your honor
  • Training
  • Practice
    Complete challenging Kata to earn honor and ranks. Re-train to hone technique
  • Freestyle Sparring
    Take turns remixing and refactoring others code through Kumite
  • Community
  • Leaderboards
    Achieve honor and move up the global leaderboards
  • Chat
    Join our Discord server and chat with your fellow code warriors
  • Discussions
    View our Github Discussions board to discuss general Codewars topics
  • About
  • Docs
    Learn about all of the different aspects of Codewars
  • Blog
    Read the latest news from Codewars and the community
  • Log In
  • Sign Up
reivash Avatar
Name:Javier
Clan:Google
Skills:java, c++, python, haskell, sql, html, css, javascript
Member Since:May 2014
Last Seen:Aug 2022
Profiles:
Following:773
Followers:767
Allies:766
View Profile Badges
  • Stats
  • Kata
  • Collections
  • Kumite
  • Social
  • Discourse
  • Conversations (28)
  • Replies
  • Authored
  • Needs Resolution
  • Custom User Avatar
    • NoneAli
    • commented on "Exclamation marks series #6: Remove n exclamation marks in the sentence from left to right" javascript solution
    • 7 months ago

    is there someone help me out about this solution ?

  • Custom User Avatar
    • bllhlc
    • commented on "Price of Mangoes" javascript solution
    • 2 years ago

    it's cool

  • Custom User Avatar
    • dafot
    • commented on "Price of Mangoes" javascript solution
    • 2 years ago

    thank you so much

  • Custom User Avatar
    • rsschool_cdcc0248efe5bad4
    • commented on "Price of Mangoes" javascript solution
    • 2 years ago

    Well, look. We multiply our passed price by the number of mangoes, minus every third bonus. That is, we use the floor method, which rounds any number down. We use this method to find jow many bonus mangoes we will have.

  • Custom User Avatar
    • NotToni
    • commented on "Price of Mangoes" javascript solution
    • 2 years ago

    I'm new to javascript. Can someone explain to me why this works the way it does?

  • Custom User Avatar
    • flybybee
    • commented on "Shortest Word" javascript solution
    • 3 years ago

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar
    • elysehadid
    • commented on "Sentence Smash" javascript solution
    • 4 years ago

    I'm 7 years late but appreciate the dialogue here!

  • Custom User Avatar
    • udovr
    • commented on "Simple Fun #209: Largest Room Area" javascript solution
    • 6 years ago

    Used the same kind of "flood" technique.
    I guess the only other way is memoïsation? (which I just learned about now :) )
    (edit: which I just finished now)

  • Custom User Avatar
    • pprunesquallor
    • commented on "Grader" python solution
    • 8 years ago

    As far as I can see with %timeit function, your solution is somewhat faster than the one above...

  • Custom User Avatar
    • reivash
    • commented on "Simple Fun #209: Largest Room Area" javascript solution
    • 8 years ago

    Apart from modifying the original object this is pretty clever. Nice one!

  • Custom User Avatar
    • Voile
    • commented on "Removing Elements" javascript solution
    • 8 years ago

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar
    • mjstromberg
    • commented on "Removing Elements" javascript solution
    • 8 years ago

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar
    • reivash
    • commented on "Logical calculator" javascript solution
    • 9 years ago

    This way you have a cleaner global namespace. I would use this solution if I'm massively doing search queries for data on the global namespace.

    If you don't need to do this I prefer the other because that way, the possible configurations are separated from the code, which in the end could be extracted to an external file so you would attach different configurations to your app on start-up or runtime and you can change its behavior dinamically without modifying the source code and recompiling.

  • Custom User Avatar
    • JohanWiltink
    • commented on "Logical calculator" javascript solution
    • 9 years ago

    Instead, it adds a variable (which should have been a constant really) to the global namespace, and you have to modify something else if a new operation is needed.

    Not sure if I follow your reasoning.

    I would have preferred

    function logicalCalc() { something }
    logicalCalc.OPS = { functions };
    

    but in this case, there's really no gain from separating OPS and logicalCalc. Just make it monolithic. You can still use the { object } [ index ] construct, which makes it easy enough to add a line if there's a need for a new operation.

    function logicalCalc(array,op) {
      return array.reduce({
        op: function() { operation }, // have one such line per operation
      }[op]);
    }
    

    If you need to change the operations, you know exactly where to look for it. And the global namespace is modified exactly as much as necessary, no more, no less.

  • Custom User Avatar
    • reivash
    • commented on "Logical calculator" javascript solution
    • 9 years ago

    This is a very good solution because you don't need to modify the logicalCalc function if a new operation is needed.

  • Loading more items...
  • © 2025 Codewars
  • About
  • API
  • Blog
  • Privacy
  • Terms
  • Code of Conduct
  • Contact

Confirm

  • Cancel
  • Confirm

Collect: undefined

Loading collection data...