On Jan 13, 5:37 pm, Arlo <arlo.carr...@gmail.com> wrote: > I am developing a JS API for my employer and I constantly ask myself > how I should accept params into my methods. So I figured I would ask > the professionals. > > Here is my scenario: > 1.) I know a handful of basic methods that I need to implement right > now. > 2.) I do not know if functionality in these methods will expand in the > future > > 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. >
Perhaps, if that's a *method*, you should not be passing any parameters... :-) poligon.points= ...; poligon.options= ...; poligon.draw(); -- Jorge. -- 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