I have a very basic JavaScript question.
I am writing a program which will generate JavaScript code. for accessing a property of a variable i have two choices:
1. make the property access a static query. i.e.
var result = object.property
OR
2. make the property access a dynamic query, i.e.
var result = object["property"]
The difference it makes to me is that for the first case (static query case) i will have to generate separate code for each property access. whereas in the second case (dynamic query case) i can reuse the same function for every property.
I can decide if i know does this makes any difference in performance?
is obj.property faster or obj["property"]?
May be this also depends on the engine which will be used to interpret javascript, so i must mention that I will be using Rhino as my javascript engine.
So please throw some light on this issue.
Thanks, Regards, VImal