-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathforLoop_practice
More file actions
28 lines (19 loc) · 1.63 KB
/
forLoop_practice
File metadata and controls
28 lines (19 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// # 1. Start with an array of numbers and create a new array with each number times 3.
// # For example, [1, 2, 3] becomes [3, 6, 9].
// # 2. Start with an array of strings and create a new array with each string upcased.
// # For example, ["hello", "goodbye"] becomes ["HELLO", "GOODBYE"].
// # 3. Start with an array of hashes and create a new array of string values from each hash's :name key.
// # For example, [{name: "Alice", age: 27}, {name: "Blane", age: 16}] becomes ["Alice", "Blane"].
// # 4. Start with an array of numbers and create a new array with each number plus 7.
// # For example, [1, 2, 3] becomes [8, 9, 10].
// # 5. Start with an array of strings and create a new array with each string's length.
// # For example, ["hello", "goodbye"] becomes [5, 7].
// # 6. Start with an array of hashes and create a new array of number values from each hash's :age key.
// # For example, [{name: "Alice", age: 27}, {name: "Blane", age: 16}] becomes [27, 16].
// # 8. Start with an array of strings and create a new array with each string's first letter only.
// # For example, ["hello", "goodbye"] becomes ["h", "g"].
// # 9. Start with an array of hashes and create a new array of number values from each hash's :age key times 2.
// # For example, [{name: "Alice", age: 27}, {name: "Blane", age: 16}] becomes [54, 32].
// # 10. Start with an array of numbers and create a new array with each number converted into a string.
// # For example, [1, 2, 3] becomes ["1", "2", "3"].
SOLUTIONS: https://github.com/TaylorOD/Deliberate_Practice-JavaScript/blob/master/solution_key/forLoop_practice_solutions.js