36

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 ?

1
  • 13
    Don't preemptively dis your own questions -- this wasn't inherently obvious to me either. Commented Oct 3, 2011 at 18:02

2 Answers 2

50

Try some thing like

(set! (.-property foo) 5)
Sign up to request clarification or add additional context in comments.

Comments

11

Use

(aset foo "property" 5)

Be aware, that symbolic references may fail.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.