Default function parameters in javascript
Snippet
kitt decided around 20:01 on 6 December 2016 to publish this:
// pre ES6, test inside the function call function go_fish(a, b) { var b = (typeof b !== 'undefined') ? b : 1; // ... } // ES6, assign in function call function go_fish(a, b = 1) { }
Source:
Add new comment