The find() method returns the value of the first element in the array that satisfies the provided function.
#[wasm_bindgen]
pub fn array_find() {
let arr= js_sys::Array::new();
arr.push(&JsValue::from("John"));
arr.push(&JsValue::from("Jane"));
arr.push(&JsValue::from("James"));
let find_item=arr.find(&mut |obj, idx, _arr|
JsValue::as_string(&obj).unwrap()=="Jane"
);
web_sys::console::log_2(&"item found: %s".into(),&find_item);
}
pub fn find(
&self,
predicate: &mut dyn FnMut(JsValue, u32, Array) -> bool
) -> JsValue