We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
JSValue::new_array
1 parent 8c2254a commit ff58b54Copy full SHA for ff58b54
src/value.rs
@@ -150,7 +150,17 @@ impl JSValue {
150
/// * `ctx`: The execution context to use.
151
/// * `items`: The array items as [`JSValue`]s.
152
///
153
- /// Returns a `JSValue` of the `array` type, other an exception.
+ /// Returns a `JSValue` of the `array` type, otherwise an exception.
154
+ ///
155
+ /// ```
156
+ /// # use javascriptcore::{JSContext, JSValue};
157
+ /// let ctx = JSContext::default();
158
+ /// let value = JSValue::new_array(
159
+ /// &ctx,
160
+ /// &[JSValue::new_number(&ctx, 1.), JSValue::new_number(&ctx, 2.)]
161
+ /// ).unwrap();
162
+ /// assert!(value.is_array());
163
164
pub fn new_array(ctx: &JSContext, items: &[JSValue]) -> Result<Self, JSException> {
165
let items = items
166
.iter()
0 commit comments