Default function parameters in javascript
Snippet
Posted by kitt at 20:01 on 6 December 2016
// 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