Unstage a file in git« an older post
a newer one »HTML spacings

Default function parameters in javascript

Snippet
// 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) {
}

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.