├── Challenge03 ├── site03.css ├── site03.js └── index.html ├── Challenge09 ├── site09.css ├── site09.js └── index.html ├── Challenge06 ├── site06.css ├── site06.js └── index.html ├── Challenge07 ├── site07.css ├── site07.js └── index.html ├── Challenge08 ├── site08.css ├── site08.js └── index.html ├── Challenge10 ├── site10.css ├── site10.js ├── index.html └── book.js ├── Challenge11 ├── site11.css ├── site11.js └── index.html ├── Challenge12 ├── site12.css ├── JSCodingChallenges1-Student.code-workspace ├── site12.js └── index.html ├── .vscode ├── settings.json └── launch.json ├── Challenge12.zip ├── img ├── CF_Mark.jpg ├── CF_Logo_BO.png └── JsChallenge.png ├── Challenge04 ├── site04.css ├── index.html └── site04.js ├── Challenge05 ├── site05.css ├── site05.js └── index.html ├── Challenge02 ├── site02.css ├── site02.js └── index.html ├── README.md ├── Challenge01 ├── site01.css ├── site01.js └── index.html ├── css └── site.css ├── js └── menu.js ├── index.html └── template └── menu.html /Challenge03/site03.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Challenge09/site09.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Challenge06/site06.css: -------------------------------------------------------------------------------- 1 | #results{ 2 | font-size : 2.0rem; 3 | } -------------------------------------------------------------------------------- /Challenge07/site07.css: -------------------------------------------------------------------------------- 1 | #results{ 2 | font-size : 2.0rem; 3 | } -------------------------------------------------------------------------------- /Challenge08/site08.css: -------------------------------------------------------------------------------- 1 | #results{ 2 | font-size : 2.0rem; 3 | } -------------------------------------------------------------------------------- /Challenge10/site10.css: -------------------------------------------------------------------------------- 1 | .heroName { 2 | 3 | 4 | 5 | } 6 | 7 | -------------------------------------------------------------------------------- /Challenge11/site11.css: -------------------------------------------------------------------------------- 1 | #results{ 2 | font-size : 2.0rem; 3 | } -------------------------------------------------------------------------------- /Challenge12/site12.css: -------------------------------------------------------------------------------- 1 | #results{ 2 | font-size : 2.0rem; 3 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "liveServer.settings.port": 5502 3 | } 4 | -------------------------------------------------------------------------------- /Challenge12.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderFoundry/JSCodingChallenges1-Student/HEAD/Challenge12.zip -------------------------------------------------------------------------------- /img/CF_Mark.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderFoundry/JSCodingChallenges1-Student/HEAD/img/CF_Mark.jpg -------------------------------------------------------------------------------- /img/CF_Logo_BO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderFoundry/JSCodingChallenges1-Student/HEAD/img/CF_Logo_BO.png -------------------------------------------------------------------------------- /img/JsChallenge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderFoundry/JSCodingChallenges1-Student/HEAD/img/JsChallenge.png -------------------------------------------------------------------------------- /Challenge12/JSCodingChallenges1-Student.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": ".." 5 | } 6 | ], 7 | "settings": { 8 | "liveServer.settings.port": 5502 9 | } 10 | } -------------------------------------------------------------------------------- /Challenge04/site04.css: -------------------------------------------------------------------------------- 1 | .checkMark{ 2 | font-size: 1.5rem; 3 | color:rgb(62, 255, 62); 4 | } 5 | 6 | .xMark{ 7 | font-size: 1.5rem; 8 | color:red; 9 | } 10 | 11 | .examples td{ 12 | font-size: 1.5rem; 13 | } -------------------------------------------------------------------------------- /Challenge05/site05.css: -------------------------------------------------------------------------------- 1 | .checkMark{ 2 | font-size: 1.5rem; 3 | color:rgb(62, 255, 62); 4 | } 5 | 6 | .xMark{ 7 | font-size: 1.5rem; 8 | color:red; 9 | } 10 | 11 | .examples td{ 12 | font-size: 1.5rem; 13 | } -------------------------------------------------------------------------------- /Challenge02/site02.css: -------------------------------------------------------------------------------- 1 | .checkMark{ 2 | font-size: 1.5rem; 3 | color:rgb(62, 255, 62); 4 | } 5 | 6 | .xMark{ 7 | font-size: 1.5rem; 8 | color:red; 9 | } 10 | 11 | .examples td{ 12 | font-size: 1.5rem; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Javascript coding challenges by Coder Foundry. 2 | 3 | The 10 most poplular coding challenges we see students face. 4 | 5 | Try and solve them and if you need help we have built a free tutorial course on https://learn.coderfoundry.com 6 | 7 | This repo does not have the solutions but gives you a framework to solve them. This repo is used in conjunction with our free course. 8 | -------------------------------------------------------------------------------- /Challenge01/site01.css: -------------------------------------------------------------------------------- 1 | .heroName { 2 | font-family: ccbiffbamboom, sans-serif; 3 | font-weight: 400; 4 | font-style: normal; 5 | color: #dbdbdb; 6 | text-transform: uppercase; 7 | background: -webkit-linear-gradient(#ececec, #0331ff); 8 | -webkit-background-clip: text; 9 | background-clip: text; 10 | letter-spacing: 3px; 11 | -webkit-text-fill-color: transparent; 12 | -webkit-text-stroke: 2px; 13 | -webkit-text-stroke-color: rgb(64, 2, 118); 14 | 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "pwa-chrome", 9 | "request": "launch", 10 | "name": "Launch Chrome against localhost", 11 | "url": "http://localhost:5500", 12 | "webRoot": "${workspaceFolder}" 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /Challenge12/site12.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | //driver function used for display and passing values. 4 | function displayNumbers() { 5 | 6 | //implement fizzbuzz and return the array of values 7 | let FizzBuzz = fizzBuzz(); 8 | 9 | //no need to change just used to display the values 10 | document.getElementById("numberslist").textContent = FizzBuzz.join(", "); 11 | } 12 | 13 | //Returns an array of numbers from 1 to 100 14 | //and for multiples of ‘3’ use “Fizz” instead of the number 15 | //and for the multiples of ‘5’ use “Buzz” 16 | // and for multiples of both 3 and 5 using "FizzBuzz". 17 | function fizzBuzz() { 18 | return []; 19 | } 20 | 21 | 22 | -------------------------------------------------------------------------------- /css/site.css: -------------------------------------------------------------------------------- 1 | body, html{ 2 | height: 100%; 3 | } 4 | 5 | body { 6 | background: #ECE9E6; /* fallback for old browsers */ 7 | background: -webkit-linear-gradient(to right, #ececec, #ECE9E6); /* Chrome 10-25, Safari 5.1-6 */ 8 | background: linear-gradient(to right, #ececec, #ECE9E6); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */ 9 | 10 | color: #0d0d0d; 11 | 12 | font-family: roboto, sans-serif; 13 | font-weight: 300; 14 | font-style: normal; 15 | 16 | } 17 | 18 | h1 { 19 | font-family: rift, sans-serif; 20 | font-weight: 700; 21 | font-style: normal; 22 | } 23 | 24 | main{ 25 | padding-top: 6rem; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /Challenge03/site03.js: -------------------------------------------------------------------------------- 1 | //driver function used for display and passing values. 2 | function convertIt() { 3 | 4 | //get the user entered value 5 | let kmValue = parseFloat(document.getElementById("InputValue").value); 6 | 7 | if (isNaN(kmValue) ) { 8 | alert("Please enter a number"); 9 | 10 | } else { 11 | //call your function to conver the vm value to miles 12 | let milesValue = convertToKm(kmValue); 13 | 14 | //display your name 15 | document.getElementById("results").innerHTML = `${kmValue} km = ${milesValue.toFixed(2)} miles`; 16 | } 17 | 18 | } 19 | 20 | //takes an array of strings and returns the longest one. 21 | function convertToKm(kmValue) { 22 | return 0; 23 | } -------------------------------------------------------------------------------- /Challenge11/site11.js: -------------------------------------------------------------------------------- 1 | const numbers = [1,3,5,7,9]; 2 | 3 | //driver function used for display and passing values. 4 | function displayNumbers() { 5 | 6 | //implement the four functions to return sum, avg, max and min 7 | let sum = sumNumbers(numbers); 8 | 9 | //used for display not need to change unless you are doing only the sum function 10 | let msg = `Sum = ${sum}`; 11 | 12 | //display the message 13 | document.getElementById("results").innerHTML = msg; 14 | document.getElementById("numberslist").innerHTML = numbers.toString(); 15 | } 16 | 17 | //takes an array of numbers and the current index in the array and returns the sum of all the numbers using recursion 18 | //Recursion is the technique of the function calling itself. 19 | function sumNumbers(numArry) { 20 | return 0; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /Challenge01/site01.js: -------------------------------------------------------------------------------- 1 | const marvelHeroes = [ 2 | "Ant-Man", 3 | "Black Panther", 4 | "Black Widow", 5 | "Captain America", 6 | "Doctor Strange", 7 | "Hawkeye", 8 | "Hulk", 9 | "Iron Man", 10 | "Luke Cage", 11 | "Moon Knight", 12 | "Ms. Marvel", 13 | "Scarlet Witch", 14 | "Spider-Man", 15 | "Thor", 16 | "Wasp" 17 | ] 18 | //driver function used for display and passing values. 19 | function findHero() { 20 | 21 | //implement the function findLongestString that returns the longest word. 22 | let lword = findLongestString(marvelHeroes); 23 | 24 | //used for display. no need to change 25 | document.getElementById("results").innerHTML = lword; 26 | 27 | //extra credit display all of the heroes to the page 28 | 29 | } 30 | 31 | //takes an array of strings and returns the longest one. 32 | function findLongestString(namesArry) { 33 | 34 | return ""; 35 | 36 | } -------------------------------------------------------------------------------- /Challenge07/site07.js: -------------------------------------------------------------------------------- 1 | //driver function used for display and passing values. 2 | function checkPalindrome() { 3 | 4 | //get values from the page. no need to change. 5 | let str = document.getElementById("wordOne").value; 6 | 7 | if (str == "") { 8 | alert("Please enter a word or phrase"); 9 | return; 10 | } 11 | 12 | //implement the isPalindrome function 13 | let palindrome = isPalindrome(str); 14 | 15 | //used for display. no need to change. 16 | let msg = ""; 17 | 18 | if (palindrome == true) { 19 | msg = "The word or phrase is a palindrome"; 20 | } 21 | else{ 22 | msg = "The word or phrase is NOT a palindrome"; 23 | } 24 | 25 | document.getElementById("results").innerHTML = msg; 26 | } 27 | 28 | //takes an string to check if it is a palindrome. 29 | //returns true or false. 30 | function isPalindrome(str) { 31 | 32 | return false; 33 | } -------------------------------------------------------------------------------- /Challenge06/site06.js: -------------------------------------------------------------------------------- 1 | //driver function used for display and passing values. 2 | function findVowels() { 3 | 4 | //getting values from the page no need to change. 5 | let str = document.getElementById("wordOne").value; 6 | 7 | if (str == "") { 8 | alert("Please enter a word or phrase"); 9 | return; 10 | } 11 | 12 | //implement getVowelCount 13 | let vowelObj = getVowelCount(str); 14 | 15 | //used for display no need to change 16 | //check if the obj returned is empty 17 | if (Object.keys(vowelObj).length === 0){ 18 | alert("Error: Vowel Object is Empty"); 19 | return; 20 | } 21 | 22 | document.getElementById("results").innerHTML = `You entered "${str}" it has ${vowelObj.vCount} vowels.
The vowels found are ${vowelObj.vFound.toString()}`; 23 | 24 | } 25 | 26 | //takes an string and returns the vowel count and the vowels found as an object. 27 | function getVowelCount(str) { 28 | 29 | return {}; 30 | 31 | } -------------------------------------------------------------------------------- /Challenge05/site05.js: -------------------------------------------------------------------------------- 1 | //driver function used for display and passing values. 2 | function checkAnagram() { 3 | 4 | //grab the two strings from the ui. no need to change 5 | //clear the results 6 | document.getElementById("results").innerHTML = ""; 7 | 8 | stringA = document.getElementById("wordOne").value; 9 | stringB = document.getElementById("wordTwo").value; 10 | 11 | if (stringA == '' || stringB == '') { 12 | alert("Please enter two words or phrases."); 13 | return; 14 | } 15 | 16 | 17 | //implement the isAnagram function 18 | let anagram = isAnagram(stringA, stringB); 19 | 20 | 21 | //used for display no need to change. 22 | let msg = ""; 23 | 24 | if (anagram == true) { 25 | msg = 'The two strings ARE anagrams'; 26 | } else { 27 | msg = 'The two strings ARE NOT anagrams'; 28 | } 29 | 30 | document.getElementById("results").innerHTML = msg 31 | } 32 | 33 | //takes an two strings and determines if the are anagarms 34 | //returns true or false 35 | function isAnagram(stringA, stringB) { 36 | return false; 37 | } -------------------------------------------------------------------------------- /Challenge02/site02.js: -------------------------------------------------------------------------------- 1 | //balanced 2 | const testbrackets1 = "[()]{}{[()()]()}"; 3 | //balanced 4 | const testbrackets2 = `([{}])`; 5 | //not balanced 6 | const testbrackets3 = "{(})[]"; 7 | //not balanced 8 | const testbrackets4 = "[(])"; 9 | //not balanced 10 | const testbrackets5 = "[()"; 11 | 12 | //driver function used for display and passing values. 13 | function checkBrackets() { 14 | 15 | //change testbrackets here. makes easire to change in one place. 16 | let testbrackets = testbrackets1; 17 | 18 | //implement isBalanced function. checks if the bracket string is balanced. 19 | let results = isBalanced(testbrackets); 20 | 21 | //used for display no need to change 22 | let msg = ""; 23 | 24 | if (results == true) { 25 | msg = `Brackets are balanced ==> ${testbrackets}`; 26 | } else { 27 | msg = `Brackets are NOT balanced ==> ${testbrackets}`; 28 | } 29 | 30 | //display the message 31 | document.getElementById("results").innerHTML = msg; 32 | 33 | } 34 | 35 | //takes an array of strings and returns the longest one. 36 | function isBalanced(brackets) { 37 | 38 | return false; 39 | 40 | } -------------------------------------------------------------------------------- /js/menu.js: -------------------------------------------------------------------------------- 1 | //generate the menu for each challenge. 2 | 3 | function getmenu(pageid) { 4 | 5 | let templateURL = '/template/menu.html'; 6 | if (pageid == 0) { 7 | templateURL = `template/menu.html`; 8 | }; 9 | 10 | fetch(templateURL) 11 | .then(res => res.text()) 12 | .then(text => { 13 | //let oldelem = document.querySelector("script#replace_with_navbar"); 14 | let parser = new DOMParser(); 15 | let shadowdoc = parser.parseFromString(text, 'text/html'); 16 | let menuTemplate = shadowdoc.getElementById("menu-template"); 17 | let menuHTML = shadowdoc.importNode(menuTemplate.content, true); 18 | let navMenu = document.getElementById("navmenu"); 19 | let menuItems = menuHTML.querySelectorAll("li"); 20 | let activeMenu = menuItems[pageid] 21 | let menuLink = activeMenu.querySelector("a"); 22 | 23 | menuLink.classList.add("active"); 24 | menuLink.setAttribute("aria-current", "page"); 25 | navMenu.innerHTML = ""; 26 | navMenu.appendChild(menuHTML); 27 | }); 28 | 29 | } -------------------------------------------------------------------------------- /Challenge08/site08.js: -------------------------------------------------------------------------------- 1 | const numbers = [9, 1, 3, 27, 15, -5, 13, 7]; 2 | 3 | //driver function used for display and passing values. 4 | function displayNumbers() { 5 | 6 | //implement the four functions to return sum, avg, max and min 7 | let sum = sumNumbers(numbers); 8 | let avg = avgNumber(numbers); 9 | let max = maxNumber(numbers); 10 | let min = minNumber(numbers); 11 | let sumRec = sumNumbersRecursive(numbers,index); 12 | 13 | //used for display not need to change unless you are doing only the sum function 14 | let msg = `Sum = ${sum}
Avg = ${avg.toFixed(2)}
Max = ${max}
Min = ${min}`; 15 | 16 | //display the message 17 | document.getElementById("results").innerHTML = msg; 18 | document.getElementById("numberslist").innerHTML = numbers.toString(); 19 | } 20 | 21 | //takes an array of numbers and returns the sum of all the numbers 22 | function sumNumbers(numArry) { 23 | return 0; 24 | } 25 | 26 | //takes an array of numbers and the current index in the array and returns the sum of all the numbers using recursion 27 | //Recursion is the technique of the function calling itself. 28 | //NOTE * SEE CHALLENGE 11. 29 | function sumNumbersRecursive(numArry, index) { 30 | return 0; 31 | } 32 | 33 | 34 | //takes an array of numbers and returns the average of all the numbers 35 | function avgNumber(numArry) { 36 | return 0; 37 | } 38 | 39 | //takes an array of numbers and returns the max number 40 | function maxNumber(numArry) { 41 | return 0; 42 | } 43 | 44 | //takes an array of numbers and returns the min number 45 | function minNumber(numArry) { 46 | return 0; 47 | } -------------------------------------------------------------------------------- /Challenge09/site09.js: -------------------------------------------------------------------------------- 1 | const marvelHeroes = [{ 2 | Alias: "Ant-Man", 3 | Name: "Scott Lang" 4 | }, 5 | { 6 | Alias: "Black Panther", 7 | Name: "T'Challa" 8 | }, 9 | { 10 | Alias: "Black Widow", 11 | Name: "Natasha Romanoff" 12 | }, 13 | { 14 | Alias: "Captain America", 15 | Name: "Steve Rogers" 16 | }, 17 | { 18 | Alias: "Doctor Strange", 19 | Name: "Stephen Strange" 20 | }, 21 | { 22 | Alias: "Hawkeye", 23 | Name: "Clint Barton" 24 | }, 25 | { 26 | Alias: "Hulk", 27 | Name: "Bruce Banner" 28 | }, 29 | { 30 | Alias: "Iron Man", 31 | Name: "Tony Stark" 32 | }, 33 | { 34 | Alias: "Power Man", 35 | Name: "Luke Cage", 36 | }, 37 | { 38 | Alias: "Moon Knight", 39 | Name: "Steven Grant" 40 | }, 41 | { 42 | Alias: "Captain Marvel", 43 | Name: "Carol Danvers" 44 | }, 45 | { 46 | Alias: "Scarlet Witch", 47 | Name: "Wanda Maximoff" 48 | }, 49 | { 50 | Alias: "Spider-Man", 51 | Name: "Peter Parker" 52 | }, 53 | { 54 | Alias: "Thor", 55 | Name: "Thor Odinson" 56 | }, 57 | { 58 | Alias: "Wasp", 59 | Name: "Janet van Dyne" 60 | } 61 | ] 62 | //driver function used for display and passing values. 63 | function findHero() { 64 | //get the values from the page. no need to change. 65 | let searchterm = document.getElementById("heroAlias").value; 66 | 67 | //implement the heroSearch function 68 | let hero = heroSearch(searchterm, marvelHeroes); 69 | 70 | //used for display. no need to change. 71 | if (hero==undefined || Object.keys(hero).length === 0){ 72 | alert("Hero not found. Try a different name"); 73 | return; 74 | } 75 | 76 | let msg = `${hero.Alias}'s real name is ${hero.Name}`; 77 | //display your message 78 | document.getElementById("results").innerHTML = msg; 79 | 80 | } 81 | 82 | //takes an array of strings and returns the longest one. 83 | function heroSearch(searchterm, marvelHeroes) { 84 | return {}; 85 | } -------------------------------------------------------------------------------- /Challenge10/site10.js: -------------------------------------------------------------------------------- 1 | //driver function 2 | function findWords() { 3 | 4 | //implement the get most used words function 5 | let words = getMostUsedWords(bookText,3); 6 | 7 | //no need to change. this is just used for display the results. 8 | if (words.length == 0){ 9 | alert("Error: No Words Found."); 10 | return; 11 | } 12 | 13 | let li = ""; 14 | 15 | words.forEach(obj => { 16 | li += `
  • "${obj.word}" is used ${obj.count} time(s)
  • `; 17 | }); 18 | 19 | let msg = `
      ${li}
    `; 20 | 21 | document.getElementById("results").innerHTML = msg; 22 | } 23 | 24 | //function to return the top 3 most used words 25 | function getMostUsedWords(wordText, topN) { 26 | return []; 27 | } 28 | 29 | 30 | //a list of stop words we don't want to include in stats 31 | function getStopWords() { 32 | return ["a", "able", "about", "across", "after", "all", "almost", "also", "am", "among", "an", "and", "any", "are", "as", "at", "be", "because", "been", "but", "by", "can", "cannot", "could", "dear", "did", "do", "does", "either", "else", "ever", "every", "for", "from", "get", "got", "had", "has", "have", "he", "her", "hers", "him", "his", "how", "however", "i", "if", "in", "into", "is", "it", "its", "just", "least", "let", "like", "likely", "may", "me", "might", "most", "must", "my", "neither", "no", "nor", "not", "of", "off", "often", "on", "only", "or", "other", "our", "own", "rather", "said", "say", "says", "she", "should", "since", "so", "some", "than", "that", "the", "their", "them", "then", "there", "these", "they", "this", "tis", "to", "too", "twas", "us", "wants", "was", "we", "were", "what", "when", "where", "which", "while", "who", "whom", "why", "will", "with", "would", "yet", "you", "your", "ain't", "aren't", "can't", "could've", "couldn't", "didn't", "doesn't", "don't", "hasn't", "he'd", "he'll", "he's", "how'd", "how'll", "how's", "i'd", "i'll", "i'm", "i've", "isn't", "it's", "might've", "mightn't", "must've", "mustn't", "shan't", "she'd", "she'll", "she's", "should've", "shouldn't", "that'll", "that's", "there's", "they'd", "they'll", "they're", "they've", "wasn't", "we'd", "we'll", "we're", "weren't", "what'd", "what's", "when'd", "when'll", "when's", "where'd", "where'll", "where's", "who'd", "who'll", "who's", "why'd", "why'll", "why's", "won't", "would've", "wouldn't", "you'd", "you'll", "you're", "you've"]; 33 | } -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CF Javascript Coding Challenges 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 |
    24 |
    25 |
    26 |
    27 |

    JS Coding Challenges

    28 |

    Build these 10 coding challenges to get ready for your next tech interview.

    29 |

    30 | These challenges are some of the most common whiteboard challenges that our students face. First 31 | try and build them. If you still need some help we have built a FREE course on learn.coderfoundry.com. 33 |

    34 |

    Sign up for your FREE account today to get this course!

    35 |
    36 |
    Powered By
    37 | 38 |
    39 |
    40 |
    41 | 42 |
    43 |
    44 |
    45 | 46 | 49 | 50 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /template/menu.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Challenge11/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | JS Challenge 11 - Sum Array Values 5 | 6 | 7 | 11 | 12 | 13 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 34 |
    35 |
    36 |
    37 |

    Sum all the values in an array

    38 |

    39 | Given an array of numbers [1,3,5,7,9] write a function that accepts 40 | the array of numbers and returns the sum of all the numbers in the 41 | array USING RECURSION.
    42 | Display a message showing the result of the function and the values 43 | in the array. 44 |

    45 | 48 |
    49 |
    Results Go Here.
    50 |
    51 |
    52 |
    53 | 54 |
    55 | 56 |
    57 |
    58 |
    59 | 60 | 61 | 66 | 67 | 72 | 73 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /Challenge08/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JS Challenge 08 - Sum Array Values 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 24 |
    25 |
    26 |
    27 |

    Sum all the values in an array

    28 |

    Given an array of numbers [9, 1, 3, 27, 15, -5, 13, 7] write a function that accepts the 29 | array of numbers and returns the sum of all the numbers in the array.
    Display a message showing the 30 | result of the function and the values in the array. 31 | 32 |

    Extra Credit: Create additional functions the return the average, max and min 33 | values of the array

    34 |
    35 | 36 |
    37 |
    38 |
    39 | Results Go Here. 40 |
    41 |
    42 | 43 |
    44 |
    45 |
    46 | 47 |
    48 | 49 |
    50 | 51 |
    52 | 53 |
    54 | 55 | 56 | 59 | 60 | 63 | 64 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /Challenge12/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JS Challenge 12 - FizzBuzz Ternary 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
    23 |
    24 |
    25 |

    FizzBuzz Ternary

    26 |

    27 | Write a program that prints the numbers from 1 to 100 and for multiples of ‘3’ print “Fizz” instead of the 28 | number and for the multiples of ‘5’ print “Buzz”. Print “FizzBuzz” for numbers which are multiples of both 3 29 | and 5. 30 |

    31 |

    32 | Implement your function using a ternary operator. 33 | Your method should return an array of values. 34 | Display the array of values on the page. 35 |

    36 |

    37 | Extra credit: Allow the user to vary the range of numbers displayed and the fizz and buzz values. 38 |

    39 | Example Output: 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz … 40 |

    41 | 44 |
    45 |
    Fizz Buzz Results
    46 |
    47 |
    48 |
    49 |
    50 | 51 |
    52 |
    53 |
    54 | 55 | 56 | 59 | 60 | 63 | 64 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /Challenge03/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JS Challenge 03 - KM to miles 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 24 |
    25 |
    26 |
    27 |

    convert kilometers to miles

    28 |

    Write a function that takes a number parameter in kilometers converts the number to 29 | miles. Return the converted number. 30 |

    31 |

    Example: 1 kilometer is equal to .6214 miles. If you enter 10 it should return 6.21 miles.

    32 |

    Extra Credit: Try to build other conversions like fahrenheit to celsius or meters to feet.

    33 | 34 | 35 |
    36 | 38 | Enter a number in kilometers 39 |
    40 |
    41 | 42 |
    43 |
    44 | Result Goes Here 45 |
    46 |
    47 |
    48 | 49 |
    50 | 51 | 52 | 53 |
    54 | 55 |
    56 | 57 | 58 | 61 | 62 | 65 | 66 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /Challenge04/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JS Challenge 04 - Sorting Arrays of Objects 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 24 |
    25 |
    26 |
    27 |

    Sort an array of objects

    28 |

    Given an array of city data. Write a function that takes an array of objects as a 29 | parameter. Sort the objects by population in desc order. Display the newly sorted array. 30 |

    31 |

    Extra Credit:
    32 | Sort the city data by the population ascending order
    33 | Sort the city data by the city name
    34 | Sort the city data by median age
    35 |

    36 |
    37 | 38 |
    39 |
    40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 |
    CityStatePopulationMedian AgeAvg Household Size
    52 |
    53 |
    54 |
    55 | 56 |
    57 |
    58 |
    59 | 60 | 61 | 64 | 65 | 68 | 69 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /Challenge06/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JS Challenge 06 - Count Vowels in a string 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 24 |
    25 |
    26 |
    27 |

    Count the vowels in a string

    28 |

    Given a string write a function that counts the vowels in the string.
    The function 29 | should return an integer of the vowel count.
    Display a message indicating the result of the function. 30 |

    31 |

    Note: For the purposes of this challenge a vowel is (a e i o u). 32 |

    33 |

    Examples 34 |

      35 |
    • "Hello" = 2 vowels (e,o)
    • 36 |
    • monkey = 2 vowels (o,e) we are ignoring y for this challenge
    • 37 |
    • William Shakespeare = 8 vowels (i,a,e) we are counting duplciates.
    • 38 |
    39 |

    40 |

    Extra Credit: Have your function return the vowel count AND the vowels found.

    41 |
    42 |
    43 | 44 |
    45 |
    46 | 47 |
    48 |
    49 |
    50 | Result Goes Here 51 |
    52 |
    53 |
    54 | 55 |
    56 |
    57 |
    58 | 59 | 60 | 63 | 64 | 67 | 68 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /Challenge07/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JS Challenge 07 - Palindrome Check 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 24 |
    25 |
    26 |
    27 |

    Check if a string is a palindrome

    28 |

    Given a string write a function that checks if the string is a palindrome.
    The function 29 | should return a boolean (true or false).
    Display a message indicating the result of the function. 30 |

    31 |

    Note: A palindrome is a word, phrase, or other sequence of characters which reads 32 | the same backward as forward, such as madam or racecar. You must account for letters and specials 33 | characters for checking 34 |

    35 |

    Examples of palindromes 36 |

      37 |
    • radar
    • 38 |
    • taco cat
    • 39 |
    • Eva, can I see bees in a cave? ("," and "?" and spaces are NOT considered)
    • 40 |
    41 |

    42 |
    43 |
    44 | 46 |
    47 |
    48 | 49 |
    50 |
    51 |
    52 | Result Goes Here 53 |
    54 |
    55 |
    56 | 57 |
    58 |
    59 |
    60 | 61 | 62 | 65 | 66 | 69 | 70 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /Challenge01/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JS Challenge 01 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 24 |
    25 |
    26 |
    27 |

    Longest String in an Array

    28 |

    Given an array of marvel heroes, write a function that accepts the array of names (strings). 29 |
    The function should return the hero with the longest name.
    The user should click the 30 | button to display the heroes name below.

    31 |

    List of Heroes

    32 | 33 | [ 34 | "Ant-Man", 35 | "Black Panther", 36 | "Black Widow", 37 | "Captain America", 38 | "Doctor Strange", 39 | "Hawkeye", 40 | "Hulk", 41 | "Iron Man", 42 | "Luke Cage", 43 | "Moon Knight", 44 | "Ms. Marvel", 45 | "Scarlet Witch", 46 | "Spider-Man", 47 | "Thor", 48 | "Wasp" 49 | ] 50 |

    51 |

    Extra Credit: Find an attractive way to display the entire list of names below 52 | the longest name.

    53 | 54 | 55 |
    56 |
    57 | 58 |
    59 |
    60 |
    61 | Heroes Name Goes Here 62 |
    63 |
    64 | 65 |
    66 |
    67 |
    68 | 69 |
    70 | 71 | 72 | 75 | 76 | 79 | 80 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /Challenge10/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JS Challenge 10 - Most Used Word 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 24 |
    25 |
    26 |
    27 |

    Most used word in a string

    28 |

    Given the provided block of text, from Alice in Wonderland (string) write a function that accepts the text 29 | (string).
    The function should return an array of objects with the top 3 most used words and the 30 | counts.
    Display the top 3 words and their 31 | counts.
    Consider only letters and numbers and filter out any special characters.

    32 | 33 |

    Example:
    34 | Input: "Hello GoodBye Hello Hello Seeya GoodBye Hello GoodBye Seeya`"
    35 | Returns: [ 36 | {word: 'hello', count: 4}, 37 | {word: 'goodbye', count: 3}, 38 | {word: 'seeya', count: 2} 39 | ] 40 |

    41 |

    42 | Extra Credit: Filter out stop words using the stop list provided. Stop words are 43 | words that do not provide any useful information to infer content or nature. 44 |

    45 | 46 |
    47 |
    48 | 49 |
    50 |
    51 |
    52 | Results Go Here 53 |
    54 |
    55 |
    56 |
    57 |
    58 | 59 |
    60 | 61 |
    62 | 63 |
    64 | 65 | 66 | 69 | 70 | 71 | 74 | 75 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /Challenge05/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JS Challenge 05 - Checking for Anagrams 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 24 |
    25 |
    26 |
    27 |

    Checking for Anagrams

    28 |

    Given two strings write a function that checks if they are anagrams.
    The function 29 | should return true or false. Display a message indicating the result of the function. 30 |

    31 |

    Note: An anagram is a word or phrase formed by rearranging the letters of a 32 | different word or phrase. 33 |

    34 |

    Examples: 35 |

      36 |
    • listen = silent
    • 37 |
    • sadder = dreads
    • 38 |
    • William Shakespeare = I am a weakish speller
    • 39 |
    • eleven plus two = twelve plus one
    • 40 |
    • a gentleman = elegant man
    • 41 |
    • the detectives = detect thieves
    • 42 |
    43 |

    44 |
    45 |
    46 | 47 |
    48 |
    49 | 50 |
    51 |
    52 | 53 |
    54 |
    55 | 56 |
    57 | Result Goes Here 58 |
    59 |
    60 |
    61 | 62 |
    63 |
    64 |
    65 | 66 | 67 | 70 | 71 | 74 | 75 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /Challenge02/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JS Challenge 02 - Balanced Brackets 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 24 |
    25 |
    26 |
    27 |

    Check for balanced brackets in a string

    28 |

    Given the string [()]{}{[()()]()}, write a function 29 | that takes a string parameter containing brackets, determine if all brackets have a matching 30 | counterpart.
    If all brackets in the string form balanced pairs, return true. If not, return false. 31 |

    32 |

    What are a balanced brackets?

    33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 |
    Note: You can use these scenarios to test your function
    BracketsBalanced?
    ([{}]) 45 | 46 |
    [(])
    {(})[]
    {()[]}
    64 | 65 |
    66 |
    67 | 68 |
    69 |
    70 |
    71 | Result Goes Here 72 |
    73 | 74 |
    75 |
    76 | 77 |
    78 | 79 | 80 | 83 | 84 | 87 | 88 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /Challenge09/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JS Challenge 09 - Search Objects 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 24 |
    25 |
    26 |
    27 |

    Search an array of objects

    28 |

    Given an array of marvel heroes write a function that accepts hero alias (string).
    29 | The 30 | function should return correponding hero object.
    Display the hero object which includes their 31 | secret 32 | identity (name).
    If the search cannot find a hero return a blank object and display a message 33 |

    34 |

    35 |

    List of Heroes

    36 | 37 | [ 38 | {Alias: "Ant-Man",Name: "Scott Lang"}, 39 | {Alias: "Black Panther", Name: "T'Challa"}, 40 | {Alias: "Black Widow", Name: "Natasha Romanoff" }, 41 | {Alias: "Captain America", Name: "Steve Rogers" }, 42 | {Alias: "Doctor Strange", Name: "Stephen Strange"}, 43 | {Alias: "Hawkeye", Name: "Clint Barton"}, 44 | {Alias: "Hulk", Name: "Bruce Banner"}, 45 | {Alias: "Iron Man", Name: "Tony Stark"}, 46 | {Alias: "Power Man", Name: "Luke Cage",}, 47 | {Alias: "Moon Knight",Name: "Steven Grant"}, 48 | {Alias: "Captain Marvel",Name: "Carol Danvers"}, 49 | {Alias: "Scarlet Witch",Name: "Wanda Maximoff"}, 50 | {Alias: "Spider-Man",Name: "Peter Parker"}, 51 | {Alias: "Thor",Name: "Thor Odinson"}, 52 | {Alias: "Wasp",Name: "Janet van Dyne"} 53 | ] 54 | 55 |

    56 |
    57 |
    58 | 60 |
    61 |
    62 | 63 |
    64 |
    65 |
    66 |
    67 | 68 |
    69 |
    70 |
    71 | Results Go Here 72 |
    73 |
    74 |
    75 | 76 |
    77 | 78 | 79 | 82 | 83 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Challenge04/site04.js: -------------------------------------------------------------------------------- 1 | let cityData = [{ 2 | city: "Jacksonville", 3 | state: "North Carolina", 4 | state_code: "NC", 5 | population: 67363, 6 | median_age: 24.2, 7 | avg_household_size: 2.51 8 | 9 | }, 10 | { 11 | city: "Cary", 12 | state: "North Carolina", 13 | state_code: "NC", 14 | population: 160514, 15 | median_age: 39.9, 16 | avg_household_size: 2.61 17 | }, 18 | { 19 | city: "Wilmington", 20 | state: "North Carolina", 21 | state_code: "NC", 22 | population: 89270, 23 | median_age: 35.5, 24 | avg_household_size: 2.24 25 | }, 26 | { 27 | city: "Concord", 28 | state: "North Carolina", 29 | state_code: "NC", 30 | population: 60500, 31 | median_age: 35.7, 32 | avg_household_size: 2.72 33 | }, 34 | { 35 | city: "Charlotte", 36 | state: "North Carolina", 37 | state_code: "NC", 38 | population: 827121, 39 | median_age: 34.3, 40 | avg_household_size: 2.52 41 | }, 42 | { 43 | city: "Asheville", 44 | state: "North Carolina", 45 | state_code: "NC", 46 | population: 88507, 47 | median_age: 37.9, 48 | avg_household_size: 2.18 49 | }, 50 | { 51 | city: "Durham", 52 | state: "North Carolina", 53 | state_code: "NC", 54 | population: 257598, 55 | median_age: 33.2, 56 | avg_household_size: 2.40 57 | }, 58 | { 59 | city: "Greenville", 60 | state: "North Carolina", 61 | state_code: "NC", 62 | population: 90588, 63 | median_age: 26.2, 64 | avg_household_size: 2.40 65 | }, 66 | { 67 | city: "Raliegh", 68 | state: "North Carolina", 69 | state_code: "NC", 70 | population: 451949, 71 | median_age: 32.8, 72 | avg_household_size: 2.42 73 | }, 74 | { 75 | city: "High Point", 76 | state: "North Carolina", 77 | state_code: "NC", 78 | population: 109828, 79 | median_age: 35.5, 80 | avg_household_size: 2.65 81 | }, 82 | { 83 | city: "Gastonia", 84 | state: "North Carolina", 85 | state_code: "NC", 86 | population: 74550, 87 | median_age: 36.9, 88 | avg_household_size: 2.67 89 | }, 90 | { 91 | city: "Fayetteville", 92 | state: "North Carolina", 93 | state_code: "NC", 94 | population: 201965, 95 | median_age: 30.7, 96 | avg_household_size: 2.50 97 | }, 98 | { 99 | city: "Winston-Salem", 100 | state: "North Carolina", 101 | state_code: "NC", 102 | population: 241232, 103 | median_age: 34.7, 104 | avg_household_size: 2.47 105 | }, 106 | { 107 | city: "Greensboro", 108 | state: "North Carolina", 109 | state_code: "NC", 110 | population: 285344, 111 | median_age: 35.5, 112 | avg_household_size: 2.36 113 | }, 114 | { 115 | city: "Kernersville", 116 | state: "North Carolina", 117 | state_code: "NC", 118 | population: 24414, 119 | median_age: 42, 120 | avg_household_size: 2.31 121 | 122 | } 123 | ]; 124 | 125 | //driver function used for display and passing values. 126 | function citySort() { 127 | 128 | 129 | sortByPopulation(cityData, "desc"); 130 | 131 | //extra credit functions 132 | //sortyByName(cityData); 133 | //sortByAge(cityData, "asc"); 134 | 135 | //used for display purposes. not need to change 136 | tbody = document.getElementById("results"); 137 | let trow = ""; 138 | //display the data 139 | cityData.forEach(item => { 140 | trow += `${item.city}${item.state_code}${item.population.toLocaleString("en-US")}${item.median_age}${item.avg_household_size}`; 141 | }); 142 | tbody.innerHTML = ""; 143 | tbody.innerHTML = trow; 144 | } 145 | 146 | //takes an array of objects and sorts by population. 147 | function sortByPopulation(cityData, sortDir) { 148 | 149 | } 150 | 151 | //takes an array of objects and sorts by median age. 152 | function sortByAge(cityData, sortDir){ 153 | 154 | } 155 | 156 | //takes an array of objects and sorts by city name. 157 | function sortyByName(cityData) { 158 | 159 | } -------------------------------------------------------------------------------- /Challenge10/book.js: -------------------------------------------------------------------------------- 1 | const bookText = `ALICE'S ADVENTURES IN WONDERLAND 2 | 3 | Lewis Carroll 4 | 5 | CHAPTER I. Down the Rabbit-Hole 6 | 7 | Alice was beginning to get very tired of sitting by her sister on the 8 | bank, and of having nothing to do: once or twice she had peeped into the 9 | book her sister was reading, but it had no pictures or conversations in 10 | it, 'and what is the use of a book,' thought Alice 'without pictures or 11 | conversations?' 12 | 13 | So she was considering in her own mind (as well as she could, for the 14 | hot day made her feel very sleepy and stupid), whether the pleasure 15 | of making a daisy-chain would be worth the trouble of getting up and 16 | picking the daisies, when suddenly a White Rabbit with pink eyes ran 17 | close by her. 18 | 19 | There was nothing so VERY remarkable in that; nor did Alice think it so 20 | VERY much out of the way to hear the Rabbit say to itself, 'Oh dear! 21 | Oh dear! I shall be late!' (when she thought it over afterwards, it 22 | occurred to her that she ought to have wondered at this, but at the time 23 | it all seemed quite natural); but when the Rabbit actually TOOK A WATCH 24 | OUT OF ITS WAISTCOAT-POCKET, and looked at it, and then hurried on, 25 | Alice started to her feet, for it flashed across her mind that she had 26 | never before seen a rabbit with either a waistcoat-pocket, or a watch 27 | to take out of it, and burning with curiosity, she ran across the field 28 | after it, and fortunately was just in time to see it pop down a large 29 | rabbit-hole under the hedge. 30 | 31 | In another moment down went Alice after it, never once considering how 32 | in the world she was to get out again. 33 | 34 | The rabbit-hole went straight on like a tunnel for some way, and then 35 | dipped suddenly down, so suddenly that Alice had not a moment to think 36 | about stopping herself before she found herself falling down a very deep 37 | well. 38 | 39 | Either the well was very deep, or she fell very slowly, for she had 40 | plenty of time as she went down to look about her and to wonder what was 41 | going to happen next. First, she tried to look down and make out what 42 | she was coming to, but it was too dark to see anything; then she 43 | looked at the sides of the well, and noticed that they were filled with 44 | cupboards and book-shelves; here and there she saw maps and pictures 45 | hung upon pegs. She took down a jar from one of the shelves as 46 | she passed; it was labelled 'ORANGE MARMALADE', but to her great 47 | disappointment it was empty: she did not like to drop the jar for fear 48 | of killing somebody, so managed to put it into one of the cupboards as 49 | she fell past it. 50 | 51 | 'Well!' thought Alice to herself, 'after such a fall as this, I shall 52 | think nothing of tumbling down stairs! How brave they'll all think me at 53 | home! Why, I wouldn't say anything about it, even if I fell off the top 54 | of the house!' (Which was very likely true.) 55 | 56 | Down, down, down. Would the fall NEVER come to an end! 'I wonder how 57 | many miles I've fallen by this time?' she said aloud. 'I must be getting 58 | somewhere near the centre of the earth. Let me see: that would be four 59 | thousand miles down, I think--' (for, you see, Alice had learnt several 60 | things of this sort in her lessons in the schoolroom, and though this 61 | was not a VERY good opportunity for showing off her knowledge, as there 62 | was no one to listen to her, still it was good practice to say it over) 63 | '--yes, that's about the right distance--but then I wonder what Latitude 64 | or Longitude I've got to?' (Alice had no idea what Latitude was, or 65 | Longitude either, but thought they were nice grand words to say.) 66 | 67 | Presently she began again. 'I wonder if I shall fall right THROUGH the 68 | earth! How funny it'll seem to come out among the people that walk with 69 | their heads downward! The Antipathies, I think--' (she was rather glad 70 | there WAS no one listening, this time, as it didn't sound at all the 71 | right word) '--but I shall have to ask them what the name of the country 72 | is, you know. Please, Ma'am, is this New Zealand or Australia?' (and 73 | she tried to curtsey as she spoke--fancy CURTSEYING as you're falling 74 | through the air! Do you think you could manage it?) 'And what an 75 | ignorant little girl she'll think me for asking! No, it'll never do to 76 | ask: perhaps I shall see it written up somewhere.' 77 | 78 | Down, down, down. There was nothing else to do, so Alice soon began 79 | talking again. 'Dinah'll miss me very much to-night, I should think!' 80 | (Dinah was the cat.) 'I hope they'll remember her saucer of milk at 81 | tea-time. Dinah my dear! I wish you were down here with me! There are no 82 | mice in the air, I'm afraid, but you might catch a bat, and that's very 83 | like a mouse, you know. But do cats eat bats, I wonder?' And here Alice 84 | began to get rather sleepy, and went on saying to herself, in a dreamy 85 | sort of way, 'Do cats eat bats? Do cats eat bats?' and sometimes, 'Do 86 | bats eat cats?' for, you see, as she couldn't answer either question, 87 | it didn't much matter which way she put it. She felt that she was dozing 88 | off, and had just begun to dream that she was walking hand in hand with 89 | Dinah, and saying to her very earnestly, 'Now, Dinah, tell me the truth: 90 | did you ever eat a bat?' when suddenly, thump! thump! down she came upon 91 | a heap of sticks and dry leaves, and the fall was over. 92 | 93 | Alice was not a bit hurt, and she jumped up on to her feet in a moment: 94 | she looked up, but it was all dark overhead; before her was another 95 | long passage, and the White Rabbit was still in sight, hurrying down it. 96 | There was not a moment to be lost: away went Alice like the wind, and 97 | was just in time to hear it say, as it turned a corner, 'Oh my ears 98 | and whiskers, how late it's getting!' She was close behind it when she 99 | turned the corner, but the Rabbit was no longer to be seen: she found 100 | herself in a long, low hall, which was lit up by a row of lamps hanging 101 | from the roof. 102 | 103 | There were doors all round the hall, but they were all locked; and when 104 | Alice had been all the way down one side and up the other, trying every 105 | door, she walked sadly down the middle, wondering how she was ever to 106 | get out again. 107 | 108 | Suddenly she came upon a little three-legged table, all made of solid 109 | glass; there was nothing on it except a tiny golden key, and Alice's 110 | first thought was that it might belong to one of the doors of the hall; 111 | but, alas! either the locks were too large, or the key was too small, 112 | but at any rate it would not open any of them. However, on the second 113 | time round, she came upon a low curtain she had not noticed before, and 114 | behind it was a little door about fifteen inches high: she tried the 115 | little golden key in the lock, and to her great delight it fitted! 116 | 117 | Alice opened the door and found that it led into a small passage, not 118 | much larger than a rat-hole: she knelt down and looked along the passage 119 | into the loveliest garden you ever saw. How she longed to get out of 120 | that dark hall, and wander about among those beds of bright flowers and 121 | those cool fountains, but she could not even get her head through the 122 | doorway; 'and even if my head would go through,' thought poor Alice, 'it 123 | would be of very little use without my shoulders. Oh, how I wish I could 124 | shut up like a telescope! I think I could, if I only knew how to begin.' 125 | For, you see, so many out-of-the-way things had happened lately, 126 | that Alice had begun to think that very few things indeed were really 127 | impossible. 128 | 129 | There seemed to be no use in waiting by the little door, so she went 130 | back to the table, half hoping she might find another key on it, or at 131 | any rate a book of rules for shutting people up like telescopes: this 132 | time she found a little bottle on it, ('which certainly was not here 133 | before,' said Alice,) and round the neck of the bottle was a paper 134 | label, with the words 'DRINK ME' beautifully printed on it in large 135 | letters. 136 | 137 | It was all very well to say 'Drink me,' but the wise little Alice was 138 | not going to do THAT in a hurry. 'No, I'll look first,' she said, 'and 139 | see whether it's marked "poison" or not'; for she had read several nice 140 | little histories about children who had got burnt, and eaten up by wild 141 | beasts and other unpleasant things, all because they WOULD not remember 142 | the simple rules their friends had taught them: such as, that a red-hot 143 | poker will burn you if you hold it too long; and that if you cut your 144 | finger VERY deeply with a knife, it usually bleeds; and she had never 145 | forgotten that, if you drink much from a bottle marked 'poison,' it is 146 | almost certain to disagree with you, sooner or later. 147 | 148 | However, this bottle was NOT marked 'poison,' so Alice ventured to taste 149 | it, and finding it very nice, (it had, in fact, a sort of mixed flavour 150 | of cherry-tart, custard, pine-apple, roast turkey, toffee, and hot 151 | buttered toast,) she very soon finished it off. 152 | 153 | 'What a curious feeling!' said Alice; 'I must be shutting up like a 154 | telescope.' 155 | 156 | And so it was indeed: she was now only ten inches high, and her face 157 | brightened up at the thought that she was now the right size for going 158 | through the little door into that lovely garden. First, however, she 159 | waited for a few minutes to see if she was going to shrink any further: 160 | she felt a little nervous about this; 'for it might end, you know,' said 161 | Alice to herself, 'in my going out altogether, like a candle. I wonder 162 | what I should be like then?' And she tried to fancy what the flame of a 163 | candle is like after the candle is blown out, for she could not remember 164 | ever having seen such a thing. 165 | 166 | After a while, finding that nothing more happened, she decided on going 167 | into the garden at once; but, alas for poor Alice! when she got to the 168 | door, she found she had forgotten the little golden key, and when she 169 | went back to the table for it, she found she could not possibly reach 170 | it: she could see it quite plainly through the glass, and she tried her 171 | best to climb up one of the legs of the table, but it was too slippery; 172 | and when she had tired herself out with trying, the poor little thing 173 | sat down and cried. 174 | 175 | 'Come, there's no use in crying like that!' said Alice to herself, 176 | rather sharply; 'I advise you to leave off this minute!' She generally 177 | gave herself very good advice, (though she very seldom followed it), 178 | and sometimes she scolded herself so severely as to bring tears into 179 | her eyes; and once she remembered trying to box her own ears for having 180 | cheated herself in a game of croquet she was playing against herself, 181 | for this curious child was very fond of pretending to be two people. 182 | 'But it's no use now,' thought poor Alice, 'to pretend to be two people! 183 | Why, there's hardly enough of me left to make ONE respectable person!' 184 | 185 | Soon her eye fell on a little glass box that was lying under the table: 186 | she opened it, and found in it a very small cake, on which the words 187 | 'EAT ME' were beautifully marked in currants. 'Well, I'll eat it,' said 188 | Alice, 'and if it makes me grow larger, I can reach the key; and if it 189 | makes me grow smaller, I can creep under the door; so either way I'll 190 | get into the garden, and I don't care which happens!' 191 | 192 | She ate a little bit, and said anxiously to herself, 'Which way? Which 193 | way?', holding her hand on the top of her head to feel which way it was 194 | growing, and she was quite surprised to find that she remained the same 195 | size: to be sure, this generally happens when one eats cake, but Alice 196 | had got so much into the way of expecting nothing but out-of-the-way 197 | things to happen, that it seemed quite dull and stupid for life to go on 198 | in the common way. 199 | 200 | So she set to work, and very soon finished off the cake.`; 201 | 202 | 203 | const testwords = `Hello GoodBye Hello Hello Seeya GoodBye Hello GoodBye Seeya`; 204 | 205 | --------------------------------------------------------------------------------