On Thu, Jan 13, 2011 at 5:37 PM, Arlo <arlo.carr...@gmail.com> wrote:
> Example Method: > A.) function drawPolygon( points, polyOptions ) { ... } > B.) function drawPolygon( options ) { ... } > > I feel that with option B I can expand functionality a lot easier than > with option A. Does anyone have advice or common pitfalls when taking > approach B? I appreciate any input. > > Always put internal ("private") arguments at the end, even when extending/improving. That way you dont have to worry about breaking scripts because, well, they're internal. Other than that, I'd say use your own judgement for which arguments to pick. Something like drawPolygon will always need coordinates but it might not always need a color or line thickness. Those are the kinds of values you would request in an options object. - peter -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.mail-archive.com/jsmentors@googlegroups.com/ To unsubscribe from this group, send email to jsmentors+unsubscr...@googlegroups.com