Problem assigning javascript object properties -


is there way assign object property pear below? (example doesn't work)

var fruitcolors = { apple: "green", pear: fruitcolors.apple}; 

i can achieve doing however, i'd like above if it's possible.

var fruitcolors = { apple: "green" }; fruitcolors.pear = fruitcolors.apple; 

i don't think can - fruitcolors object doesn't exist @ time trying access it's property.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -