Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can use ES6 default parameters to implement options objects, so instead of:

    function foo(x, options) {
      var y = options.y | 0;
      return x + y;
    }
You can write:

    function foo(x, y = 0) {
      console.log(x + y);
    }
Problem solved!


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: