JavaScript Inheritance and Object Programming

Coding Tutorial, Chapter 4c

Composition: Add Borders Defaults

© 21 July, 2013, Martin Rinehart


Results

You can see your defaults on your boxes.

Code

You can put constants, such as a DEFAULTS object, anywhere in the source. We like ours at the top (where it's easy to find when the designer changes his/her mind). We also like styles that really stand out (but only during development).



Add a statement to your Box.init() to use the defaults. Ours comes just after the parameters are copied into properties.

Feedback: Martin Rinehart at gmail dot com.

# # #