UNPKG

999 BMarkdownView Raw
1----------------------------------------------------------------------
2
3## Task
4
5Replace the `for` loop in *{boilerplate:map.js}* with an ES5 `Array#map()` loop while maintaining the original functionality.
6
7----------------------------------------------------------------------
8
9## Description
10
11You will find a Node.js program file named *{boilerplate:map.js}* in your current working directory. Execute the program with `node {boilerplate:map.js}`.
12
13*{boilerplate:map.js}* takes an arbitrary number of command-line arguments and calculates an array containing the length (in characters) of each argument.
14
15The resulting array is then encoded as JSON and printed to stdout.
16
17## Example
18
19 $ node {boilerplate:map.js} one two three four
20 [3,3,5,4]
21
22## Conditions
23
24* Your submission will be judged for correct output and the use of `Array#map()`.
25* Warning: Any use of `for`, `while` or `do...while` will constitute a failure!
26
27----------------------------------------------------------------------