Use default arguments instead of conditionals

August 03, 2017

Bad

functioncreateMicrobrewery(name) {
  constbreweryName= name ||'Hipster Brew Co.';
  // ...
}

Good

functioncreateMicrobrewery(breweryName='Hipster Brew Co.') {
  // ...
}

Tagged withjavascript

Questions, Comments, Suggestions? Open an Issue