forked from RachelKoldenhoven/fundamentals-day-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
99_review.js
60 lines (31 loc) · 1.85 KB
/
99_review.js
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
56
57
58
59
// Define a function called "greeting". It should accept two parameters, which will be names.
// The function should log a greeting to both people.
const greeting = () => {
};
greeting("Rachel", "Brent");
// Write a function called 'changeCounter' that accepts coins and returns total amount in dollars (or currency of your choice).
// Create a new function called minimum3() that accepts 3 numbers and logs the smallest one
minimum3(1, 2, 3);
minimum3(6, 5, 4);
minimum3(3, 1, 2);
minimum3(1, 1, 1);
// Declare a function called sum() that takes an array of numbers as an argument adds them.
// i.e. sum([1, 2, 3, 4]) should return 10.
sum([1, 2, 3, 4, 5, 6]);
// Write a function that accepts a string and reverses it.
// Write a function accepts a six-digit number that reverses the number.
// (Hint, you will have to turn the integer into a string before you can reverse it.)
const sixDigitNum = 123456;
// Write a function that accepts the following array and separates the people into two teams.
// No names next to each other in the array should be on the same team.
const teammates = ["Yuina", "Ren", "Hiroto", "Hina", "Yuuma", "Minato", "Airi", "Mei", "Yuuto", "Haruto", "Koharu"]
// Write a function called filterSixPlus() that takes the following array and logs words
// that are six characters or longer.
const words = ["bento", "metro", "shinkansen", "onsen", "izakaya", "tatami"];
// Write a function countTs() that takes a string as its only argument and returns
// a number that indicates how many uppercase “T” characters are in the string.
// HINT: Google charAt()
countTs("Tomo wants to visit Tsukigi market in Tokyo.");
// Write a function called countChars() that behaves like countTs(), except it takes a
// second argument that indicates what character is to be counted.
countChars("Tomo wants to visit Tsukigi market in Tokyo.", "o");