-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy pathfor.js
More file actions
56 lines (42 loc) · 1.29 KB
/
for.js
File metadata and controls
56 lines (42 loc) · 1.29 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
56
/**** Problem 1 ****
Given a string of any length, return true if it contains at least one space.
Examples:
containsSpace("star wars") → true
containsSpace(" ") → true
containsSpace("") → false
*/
function containsSpace(str) {
}
// test your function below
console.log("containsSpace() test");
//console.log(containsSpace("star wars"));
//console.log(containsSpace(" "));
//console.log(containsSpace(""));
/**** Problem 2 ****
Given a string of any length, return the total number of times "a" or "A" appears.
Examples:
countAs("happy") → 1
countAs("lady gaga") → 3
countAs("") → 0
*/
function countAs(str) {
}
// test your function below
console.log("countAs() test");
//console.log(countAs("happy"));
//console.log(countAs("lady gaga"));
//console.log(countAs(""));
/**** Problem 3 ****
Given a string of any length, return a new string that is a copy of that string in reverse.
Examples:
reverseString("banana") → "ananab"
reverseString("Was it a car or a cat I saw?") → "?was I tac a ro rac a ti saW"
reverseString("doorag") → "garood"
*/
function reverseString(str) {
}
// test your function below
console.log("reverseString() test");
//console.log(reverseString("banana"));
//console.log(reverseString("Was it a car or a cat I saw?"));
//console.log(reverseString("doorag"));