function/macrosince v0.0-927 clojure.core/agetEdit
(aget array idx)
(aget array idx & idxs)


Returns the value at index i of a JavaScript array.

(def a #js [1 2 3])
(aget a 0)
;;=> 1

Retrieve nested elements with the additional idxs arguments.

(def a #js [1 2 #js [3 4]])
(aget a 2 0)
;;=> 3

For JavaScript objects, use goog.object/get or the multi-arity goog.object/getValueByKeys.

(require 'goog.object)
(def obj #js {:foo #js {:bar 2}})

(goog.object/get obj "foo")
;;=> #js {:bar 2} 

(goog.object/getValueByKeys obj "foo" "bar")
;;=> 2

See Also:

Source docstring:
Returns the value at the index/indices. Works on JavaScript arrays.
Function code @ clojurescript:src/main/cljs/cljs/core.cljs
(defn aget
  ([array idx]
     (cljs.core/aget array idx))
  ([array idx & idxs]
     (apply aget (aget array idx) idxs)))

Macro code @ clojurescript:src/main/clojure/cljs/core.cljc
(core/defmacro aget
  ([array idx]
   (core/case (ana/checked-arrays)
     :warn `(checked-aget ~array ~idx)
     :error `(checked-aget' ~array ~idx)
     (core/list 'js* "(~{}[~{}])" array idx)))
  ([array idx & idxs]
   (core/case (ana/checked-arrays)
     :warn `(checked-aget ~array ~idx ~@idxs)
     :error `(checked-aget' ~array ~idx ~@idxs)
     (core/let [astr (apply core/str (repeat (count idxs) "[~{}]"))]
       `(~'js* ~(core/str "(~{}[~{}]" astr ")") ~array ~idx ~@idxs)))))