pub fn len(arr: &JsValue) -> Option<usize>Expand description
Get the length of an array.
Returns None if this is not an array.
ยงExample
use tsrun::{Interpreter, api};
use serde_json::json;
let mut interp = Interpreter::new();
let guard = api::create_guard(&interp);
let arr = api::create_from_json(&mut interp, &guard, &json!([1, 2, 3, 4, 5])).unwrap();
assert_eq!(api::len(&arr), Some(5));