Skip to content

Instantly share code, notes, and snippets.

@goonoo
Created February 18, 2013 07:26
Show Gist options
  • Save goonoo/4975654 to your computer and use it in GitHub Desktop.
Save goonoo/4975654 to your computer and use it in GitHub Desktop.
설정 객체의 단점 중 매개변수의 이름을 기억해야 한다는 것 극복 + 기본값 부여 방법
function addPerson (conf) {
var options = $.extend({
username: null,
first: null,
last: null,
birthday: new Date(1970, 1, 1),
gender: "unknown"
}, conf);
// blah blah
}
@nephilim
Copy link

우와~ 이런 거군요. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment