The Stack:
An Example
1 function upperCaseFirst(word) {
2 return word[0].toUpperCase() + word.slice(1);
3 }
4
5 function upperCaseWords(sentence) {
6 var words = sentence.split(" ");
7 for (var i = 0; i < words.length; i++) {
8 words[i] = upperCaseFirst(words[i]);
9 }
10 return words.join(" ");
11 }
12
13 upperCaseWords("lowercase words");
Stack Example
13 function: main
Stack:
1 function upperCaseFirst(word) {
2 return word[0].toUpperCase() + word.slice(1);
3 }
4
5 function upperCaseWords(sentence) {
6 var words = sentence.split(" ");
7 for (var i = 0; i < words.length; i++) {
8 words[i] = upperCaseFirst(words[i]);
9 }
10 return words.join(" ");
11 }
12
13 upperCaseWords("lowercase words");
Stack Example
13 function: main
Stack:
6 function: upperCaseWords
1 function upperCaseFirst(word) {
2 return word[0].toUpperCase() + word.slice(1);
3 }
4
5 function upperCaseWords(sentence) {
6 var words = sentence.split(" ");
7 for (var i = 0; i < words.length; i++) {
8 words[i] = upperCaseFirst(words[i]);
9 }
10 return words.join(" ");
11 }
12
13 upperCaseWords("lowercase words");
Stack Example
13 function: main
Stack:
6 function: upperCaseWords
? function: split
1 function upperCaseFirst(word) {
2 return word[0].toUpperCase() + word.slice(1);
3 }
4
5 function upperCaseWords(sentence) {
6 var words = sentence.split(" ");
7 for (var i = 0; i < words.length; i++) {
8 words[i] = upperCaseFirst(words[i]);
9 }
10 return words.join(" ");
11 }
12
13 upperCaseWords("lowercase words");
Stack Example
13 function: main
Stack:
8 function: upperCaseWords
1 function upperCaseFirst(word) {
2 return word[0].toUpperCase() + word.slice(1);
3 }
4
5 function upperCaseWords(sentence) {
6 var words = sentence.split(" ");
7 for (var i = 0; i < words.length; i++) {
8 words[i] = upperCaseFirst(words[i]);
9 }
10 return words.join(" ");
11 }
12
13 upperCaseWords("lowercase words");
Stack Example
13 function: main
Stack:
8 function: upperCaseWords
2 function: upperCaseFirst
1 function upperCaseFirst(word) {
2 return word[0].toUpperCase() + word.slice(1);
3 }
4
5 function upperCaseWords(sentence) {
6 var words = sentence.split(" ");
7 for (var i = 0; i < words.length; i++) {
8 words[i] = upperCaseFirst(words[i]);
9 }
10 return words.join(" ");
11 }
12
13 upperCaseWords("lowercase words");
Stack Example
13 function: main
Stack:
8 function: upperCaseWords
2 function: upperCaseFirst
? function: toUpperCase
1 function upperCaseFirst(word) {
2 return word[0].toUpperCase() + word.slice(1);
3 }
4
5 function upperCaseWords(sentence) {
6 var words = sentence.split(" ");
7 for (var i = 0; i < words.length; i++) {
8 words[i] = upperCaseFirst(words[i]);
9 }
10 return words.join(" ");
11 }
12
13 upperCaseWords("lowercase words");
Stack Example
13 function: main
Stack:
8 function: upperCaseWords
2 function: upperCaseFirst
? function: slice
1 function upperCaseFirst(word) {
2 return word[0].toUpperCase() + word.slice(1);
3 }
4
5 function upperCaseWords(sentence) {
6 var words = sentence.split(" ");
7 for (var i = 0; i < words.length; i++) {
8 words[i] = upperCaseFirst(words[i]);
9 }
10 return words.join(" ");
11 }
12
13 upperCaseWords("lowercase words");
Stack Example
13 function: main
Stack:
8 function: upperCaseWords
1 function upperCaseFirst(word) {
2 return word[0].toUpperCase() + word.slice(1);
3 }
4
5 function upperCaseWords(sentence) {
6 var words = sentence.split(" ");
7 for (var i = 0; i < words.length; i++) {
8 words[i] = upperCaseFirst(words[i]);
9 }
10 return words.join(" ");
11 }
12
13 upperCaseWords("lowercase words");
Stack Example
13 function: main
Stack:
10 function: upperCaseWords
? function: join
1 function upperCaseFirst(word) {
2 return word[0].toUpperCase() + word.slice(1);
3 }
4
5 function upperCaseWords(sentence) {
6 var words = sentence.split(" ");
7 for (var i = 0; i < words.length; i++) {
8 words[i] = upperCaseFirst(words[i]);
9 }
10 return words.join(" ");
11 }
12
13 upperCaseWords("lowercase words");
Stack Example
13 function: main
Stack:
The Stack: An Example
By Elie Schoppik
The Stack: An Example
- 2,488