apply: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Some wiki formatting) |
Lou Montana (talk | contribs) m (Text replacement - "\[ *(https?:\/\/[^ = ]+) +([^= ]+) *\]" to "{{Link|$1|$2}}") |
||
Line 50: | Line 50: | ||
|user= Fusselwurm | |user= Fusselwurm | ||
|timestamp= 20160218110300 | |timestamp= 20160218110300 | ||
|text= (to anyone else wondering, I took a minute to get it) this is | |text= (to anyone else wondering, I took a minute to get it) this is {{Link|https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map|Array.map()}} in JavaScript | ||
}} | }} | ||
Revision as of 15:11, 28 April 2023
Description
- Description:
- Applies the given code to each element of the given data structure and collects the results in an array.
- Groups:
- ArraysHashMap
Syntax
- Syntax:
- array apply code
- Parameters:
- array: Array - Array of Anything
- code: Code - code to be executed on each element of the array. The current element value is stored in the magic variable _x.
- Return Value:
- Array - resulting array
Alternative Syntax
- Syntax:
- hashmap apply code
- Parameters:
- hashmap: HashMap
- code: Code - Code to be executed on each key-value pair of the hashmap. The current key is stored in the magic variable _x, the corresponding value is stored in _y.
- Return Value:
- Array - resulting array
Examples
- Example 1:
- Example 2:
- Example 3:
- Example 4:
- Example 5:
Additional Information
- See also:
- set resize pushBack pushBackUnique select reverse count find in forEach deleteAt deleteRange append sort arrayIntersect
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
- Posted on Feb 18, 2016 - 11:03 (UTC)
- (to anyone else wondering, I took a minute to get it) this is Array.map() in JavaScript