js_sys::Array::get function

Example

Get the element at the specified index. The undefined value will be returned if the index is out of range.


pub fn array_get() {
    let arr = js_sys::Array::new_with_length(3);
    arr.set(0,JsValue::from_str("Apple"));    
    arr.set(1,JsValue::from_str("Orange"));    
    web_sys::console::log_2(&"Get Value:%s".into(),&arr.get(1));
}
                                    

Function


            pub fn get(&self, index: u32) -> JsValue
           

features/dependencies

Source Code