forked from learn-co-curriculum/phase-1-array-map-method-lab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
31 lines (26 loc) · 923 Bytes
/
index.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
const tutorials = [
'what does the this keyword mean?',
'What is the Constructor OO pattern?',
'implementing Blockchain Web API',
'The Test Driven Development Workflow',
'What is NaN and how Can we Check for it',
'What is the difference between stopPropagation and preventDefault?',
'Immutable State and Pure Functions',
'what is the difference between == and ===?',
'what is the difference between event capturing and bubbling?',
'what is JSONP?'
];
function capitalizeFirstLetterInArray(arr) {
let capitalizedArray = arr.map(function(str) {
let words = str.split(" ");
let capitalizedWords = words.map(function(word) {
return word.charAt(0).toUpperCase() + word.slice(1);
});
let capitalizedStr = capitalizedWords.join(" ");
return capitalizedStr;
});
return capitalizedArray;
}
const titleCased = () => {
return capitalizeFirstLetterInArray(tutorials);
}