On Mon, Oct 5, 2015 at 9:00 AM, Benjamin Gruenbaum wrote:
> Well, I've personally thought about building a small pattern matching
> library using the syntax, but that's hardly a general use case:
>
> ```js
> match(
> (x = 1) => doFoo(...)
> (x = {y : 3}) => doBar(...)
> ```
That's just syntax pun
;
> > From what I understand (correct me if I'm wrong) - there is no way to
> get the default values of a parameter of a function in JavaScript. For
> example:
> >
> > ```js
> > function foo(x = 5){
> >
> > }
> > Reflect.getDefaultParameterValues(
have a means to retrieve the default parameter values of a function.
> >
> > From what I understand (correct me if I'm wrong) - there is no way to
> get the default values of a parameter of a function in JavaScript. For
> example:
> >
> > ```js
> > function f
cript. For example:
>
> ```js
> function foo(x = 5){
>
> }
> Reflect.getDefaultParameterValues(foo); // {x : 5}
> ```
>
> This would be very nice to have in the language in my opinion.
>
> Now, doing this right sounds a bit challenging. since default parameter
t. For example:
>
> ```js
> function foo(x = 5){
>
> }
> Reflect.getDefaultParameterValues(foo); // {x : 5}
> ```
>
> This would be very nice to have in the language in my opinion.
>
> Now, doing this right sounds a bit challenging. since default parameters
ipt. For example:
```js
function foo(x = 5){
}
Reflect.getDefaultParameterValues(foo); // {x : 5}
```
This would be very nice to have in the language in my opinion.
Now, doing this right sounds a bit challenging. since default parameters
get their value on every invocation of the function, it would
6 matches
Mail list logo