2015-10-21
- jennifer
- martym
| // Bonfire: Title Case a Sentence | |
| // Author: @thetinybeaker | |
| // Challenge: http://www.freecodecamp.com/challenges/bonfire-title-case-a-sentence | |
| // Learn to Code at Free Code Camp (www.freecodecamp.com) | |
| function titleCase(str) { | |
| var myArray = str.toLowerCase().split(' '); | |
| var newArray = []; | |
| for (i = 0; i < myArray.length; i++) { |
| // Bonfire: Find the Longest Word in a String | |
| // Author: @thetinybeaker | |
| // Challenge: http://www.freecodecamp.com/challenges/bonfire-find-the-longest-word-in-a-string | |
| // Learn to Code at Free Code Camp (www.freecodecamp.com) | |
| function findLongestWord(str) { | |
| // split up the words and put them into an array | |
| var words = str.split(' '); | |
| // make an empty array to put the lengths of each words into | |
| var numbers = []; |
| // Bonfire: Check for Palindromes | |
| // Author: @thetinybeaker | |
| // Challenge: http://www.freecodecamp.com/challenges/bonfire-check-for-palindromes | |
| // Learn to Code at Free Code Camp (www.freecodecamp.com) | |
| function palindrome(str) { | |
| //turn original string to lowercase, then eliminate any non-alphanumeric values and spaces. | |
| var initString = str.toLowerCase().replace(/[\W_]/g,''); | |
| //take that 'normalized' string and split and reverse. | |
| var revString = initString.split('').reverse().join(''); |
| // Bonfire: Factorialize a Number | |
| // Author: @thetinybeaker | |
| // Challenge: http://www.freecodecamp.com/challenges/bonfire-factorialize-a-number | |
| // Learn to Code at Free Code Camp (www.freecodecamp.com) | |
| // Return factorial of a given interger passed though the factorialize function. | |
| function factorialize(num) { | |
| // if num (recursively gotten to value of 0, or starts out at 0) is 0, then the function returns 1. | |
| if (num === 0){ |
| // Bonfire: Reverse a String | |
| // Author: @thetinybeaker | |
| // Challenge: http://www.freecodecamp.com/challenges/bonfire-reverse-a-string# | |
| // Learn to Code at Free Code Camp (www.freecodecamp.com) | |
| /* | |
| Reverse the provided string. | |
| You may need to turn the string into an array before you can reverse it. | |
| Your result must be a string. | |
| */ |
| // Bonfire: Meet Bonfire | |
| // Author: @thetinybeaker | |
| // Challenge: http://www.freecodecamp.com/challenges/bonfire-meet-bonfire# | |
| // Learn to Code at Free Code Camp (www.freecodecamp.com) | |
| /*Bonfire text: | |
| Your goal is to fix the failing test. | |
| First, run all the tests by clicking "Run tests" or by pressing Control + Enter. | |
| The failing test is in red. Fix the code so that all tests pass. Then you can move on to the next Bonfire. | |
| Make this function return true no matter what.*/ |