2
fruitfcker
126d

If you know...

Comments
  • 4
    .filter(a => a)
    🤦‍♂️
  • 1
    "I'm calling cops mother fucker".split("").map(parseInt).filter(a=>a).reduce((a,b) => a+b).toString().split("").reverse().join("")
  • 0
    window.parseInt is not a function
  • 0
    if the answer is not sex , then i am not going to open a browser and type all this shit
  • 0
    It's NaN, isn't it
  • 0
    @dotenvironment Oh it's definately not sex. But it depends who you ask.
  • 3
    @Lensflare .map(parseInt) is worse. Index is used as radix 🤦‍♂️
  • 1
    @hjk101 the joys of currying combined with optional parameters.
  • 1
    @lorentz in JS, every parameter is optional.
  • 0
    @Lensflare What bugs me especially is that this would probably work in Typescript as well. First-class functions are marched purely by type, so if a caback fits it sits.
  • 0
    I wonder how unintended argument aliasing can be solved with language design. Sure abandoning fcf or optional arguments is one way to do it, but those are also useful.
  • 0
    Maybe one could force users to specify the arity, perhaps with the function/n syntax Elixir uses, when functions are passed directly by name and neither the argument nor the callee is a locally defined function with no optional parameters
  • 1
    @lorentz why not just forbid to pass functions as values when they have more than one parameter?
    Piping multiple values would be an unreadable mess anyway.
  • 0
    @Lensflare That actually makes a lot of sense. If you spell out the arguments, an inconsistency in their order is both very obvious and very easy to fix.
Add Comment