Wrox Programmer Forums
BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0
This is the forum to discuss the Wrox book Professional JavaScript for Web Developers by Nicholas C. Zakas; ISBN: 9780764579080
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 17th, 2005, 01:24 PM
Registered User
Join Date: Oct 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default addProperty()

Hi Nicholas,

As one who uses Gets and Sets in any new Object I design I found your addProperty() function to be fantastic.

The only thing I wish it did different (if possible) was make the variable a local variable to the object instance and not exposed through "this.".

Is this possible? I tried and was not able to do so.

Old October 17th, 2005, 07:59 PM
nzakas's Avatar
Wrox Author
Join Date: Dec 2004
Posts: 217
Thanks: 0
Thanked 5 Times in 5 Posts


It's possible, but not very practical. It involves a lot of work just to create something that ultimately doesn't give you any advantage over using instance variables. If you're interested in learning more about such techniques, check out http://www.litotes.demon.co.uk/js_in...te_static.html

Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.