In previous lessons, we covered all the basics one full stack app can have. Now is the time for you to implement all these features one more time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let convertToSnake = (camelCased) => { | |
let lettersArr = [...camelCased]; | |
let snaked_str = ''; | |
lettersArr.forEach(letter => { | |
if(letter !== letter.toUpperCase()){ | |
snaked_str += letter | |
} else { | |
snaked_str += `_${letter.toLowerCase()}` | |
} | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this solution is the most efficient because it walks the array only once and | |
// it doesn't use any helper methods | |
const firstNonRepeatingLetterA = (str) => { | |
let theObj = {}; | |
for(let i = 0; i< str.length; i++){ | |
if(theObj[str[i]]){ | |
theObj[str[i]]+=1; | |
} else { | |
theObj[str[i]] = 1; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// new SortedList should create a new object from the SortedList class | |
// The object should have a items and length property | |
// items should be an array | |
// length should be the number of elements in the array | |
class SortedList { | |
constructor(){ | |
this.items = []; | |
this.length = this.items.length; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// // Soldier | |
class Soldier { | |
constructor(health, strength) { | |
this.health = health; | |
this.strength = strength; | |
} | |
attack() { | |
return this.strength; | |
} | |
receiveDamage(damage) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log("------------ iteration 1 ------------"); | |
// Iteration 1: Names and Input | |
// 1.1 Create a variable hacker1 with the driver's name. | |
let hacker1 = "kevin"; | |
// 1.2 Print "The driver's name is XXXX". | |
console.log(`hacker1's name is ${hacker1}`); | |
// 1.3 Create a variable hacker2 with the navigator's name. |
OlderNewer