Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Destructuring assignment could also helps readability, for example:

  function replace(text, {fromText = '', toText = '', caseInsensitive = false} = {}){
  	//
  	// ...
  	//
  }

  replace(
  	'Get on the Road',
  	{
  		fromText: 'road',
  		toText: 'bus',
  		caseInsensitive: true
  	}
  );


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: