Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] property instead of method


  • From: sclay at ufl.edu (Steve Clay)
  • Subject: [Javascript] property instead of method
  • Date: Wed May 24 08:08:00 2006

Tuesday, May 23, 2006, 10:50:30 PM, Geoff Knutzen wrote:
> This works and gives me easy access like this
> x = formParams.minValue();

> Is there a way to make minValue a propery instead of a method
> so I can get the value this way
> x = formParams.minValue

x = formParams.minValue;
x = x();

OK, that's cheating ;) A property is just a variable, so you have to set it
somewhere; it can't magically change without assistance. If you wanted to
turn minValue into a property, you'd need to run the calculation code
/somewhere else/ to update it.

What's wrong with calling it as a method?

Steve
-- 
http://mrclay.org/