Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 33 additions & 7 deletions Day01/Problem01.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,35 @@ class Problem {
* separated by single spaces.
*/
wordCount(input) {
// code goes here
return null;
//identify and add the number of spaces in the string and then add one as each word will be identified as
//such by the space that follows it with the exception of the last word which is not followed by a space
return input.split(' ').length;
}


/**
* Have the function LetterCapitalize(str) take the str parameter being passed and capitalize the first
letter of each word. Words will be separated by only one space.
*
*/

letterCapitalize(str) {
return null;
}
//identify spaces
//then capitalize the first character in the string and every character after a space
var strArr = str.split(' ');
var newArr = [];

for(var i = 0 ; i < strArr.length ; i++ ){

var FirstLetter = strArr[i].charAt(0).toUpperCase();
var restOfWord = strArr[i].slice(1);

newArr[i] = FirstLetter + restOfWord;

}

return newArr.join(' ');

}



Expand All @@ -28,7 +44,13 @@ class Problem {
* program should return the string sredoC dna dlroW olleH.
*/

//


firstReverse(input){

//take string and index
//then reverse order of index numbers to count down instead of up
return null;
}

Expand All @@ -39,7 +61,10 @@ class Problem {
* input will not be empty.
*/
longestWord(input) {
// code goes here

//assign values to words by counting the number of characters between spaces
//then create a loop comparing each value
//return the one or two values that are highest
return null;
}

Expand All @@ -49,7 +74,8 @@ class Problem {
* Let numbers and symbols stay the way they are.
*/
swapCase(str) {
// code goes here

//create an if/else to indicate that if a character is lowercase to change uppercase, else change to lowercase
return null;
}

Expand Down
Loading