File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -1300,7 +1300,14 @@ extern "C" {
1300
1300
1301
1301
/// The `forEach()` method executes a provided function once per each
1302
1302
/// key/value pair in the Map object, in insertion order.
1303
- ///
1303
+ /// Note that in Javascript land the `Key` and `Value` are reversed compared to normal expectations:
1304
+ /// # Examples
1305
+ /// ```
1306
+ /// let js_map = Map::new();
1307
+ /// js_map.for_each(&mut |value, key| {
1308
+ /// // Do something here...
1309
+ /// })
1310
+ /// ```
1304
1311
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/forEach)
1305
1312
#[ wasm_bindgen( method, js_name = forEach) ]
1306
1313
pub fn for_each ( this : & Map , callback : & mut dyn FnMut ( JsValue , JsValue ) ) ;
You can’t perform that action at this time.
0 commit comments