Anonymous user
Add a variable to a class instance at runtime: Difference between revisions
Add a variable to a class instance at runtime (view source)
Revision as of 07:31, 31 October 2009
, 14 years ago→{{header|JavaScript}}
No edit summary |
|||
Line 148:
This kind of thing is fundamental to JavaScript, as it's a prototype-based language rather than a class-based one.
<lang javascript> e = {} // generic object
e.foo = 1
e["bar"] = 2 // name specified at runtime</lang>
=={{header|Lua}}==
|