35
votes

Dumb question: how do I do Javascript assignment in Clojurescript ? I'm using a Javascript lib and need to set the value of an object's field like obj.this=that; - I don't know Javascript so maybe there's a .set method ?

2
Don't preemptively dis your own questions -- this wasn't inherently obvious to me either. - Tim Clemons

2 Answers

49
votes

Try some thing like

(set! (.-property foo) 5)
11
votes

Use

(aset foo "property" 5)

Be aware, that symbolic references may fail.