-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy patharrayFunctions.js
More file actions
55 lines (50 loc) · 1.49 KB
/
arrayFunctions.js
File metadata and controls
55 lines (50 loc) · 1.49 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
* getOdds(numbers):
* - receives an array of numbers called `numbers`
* - filters the `numbers` array in order to...
* - returns an array of only ODD numbers.
*
* e.g.
* getOdds([1, 2, 3, 4, 5, 6, 7, 8, 9]) -> [1, 3, 5, 7, 9]
* getOdds([11, 35, 52, 14, 56, 601, 777, 888, 999]) -> [11, 35, 601, 777, 999]
*/
function getOdds(numbers) {
// Your code here
}
/**
* getEvens(numbers):
* - receives an array of numbers called `numbers`
* - filters the `numbers` array in order to...
* - returns an array of only EVEN numbers.
*
* e.g.
* getEvens([1, 2, 3, 4, 5, 6, 7, 8, 9]) -> [2, 4, 6, 8]
* getEvens([11, 35, 52, 14, 56, 601, 777, 888, 999]) -> [52, 14, 56, 888]
*/
function getEvens(numbers) {
// Your code here
}
/**
* countOccurences(x, numbers):
* - receives a number `x`, and an array of numbers called `numbers`
* - returns the number of times `x` occurs in `numbers`.
*
* e.g.
* countOccurences(1, [1, 2, 3, 1, 4, 5, 6, 1, 7, 8, 9, 10, 11, 1, 12, 13]) -> 4
* countOccurences(52, [11, 35, 52, 14, 56, 601, 52, 777, 888, 999, 52]) -> 3
*/
function countOccurences(x, numbers) {
// Your code here
}
/**
* makeThemDoctors(students):
* - receives array `students`
* - returns an array with the same elements of students with prefix `Dr. `
*
* e.g.
* makeThemDoctors(["Ali", "Aseel", "Richard"]) -> ["Dr. Ali", "Dr. Aseel", "Dr. Richard"]
*/
function makeThemDoctors(students) {
// Your code here
}
module.exports = { getOdds, getEvens, countOccurences, makeThemDoctors };