File: breaking_changes_default_values.md

package info (click to toggle)
coffeescript 2.7.0%2Bdfsg1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,376 kB
  • sloc: makefile: 20; xml: 9; javascript: 5; sh: 1
file content (11 lines) | stat: -rw-r--r-- 708 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
### Default values for function parameters and destructured elements

Per the [ES2015 spec regarding function default parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters) and [destructuring default values](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Default_values), default values are only applied when a value is missing or `undefined`. In CoffeeScript 1.x, the default value would be applied in those cases but also if the  value was `null`.

```
codeFor('breaking_change_function_parameter_default_values', 'f(null)')
```

```
codeFor('breaking_change_destructuring_default_values', 'a')
```