This file contains 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
const args = process.argv.slice(2); | |
let str = ""; | |
for (let i = 0; i <= args.length - 1; i++) { | |
let phrase = ""; | |
let firstLetter = ""; | |
for (let j = 0; j <= args[i].length - 1; j++) { | |
if (j === 0) { | |
firstLetter = args[i][0]; | |
} else { |
This file contains 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
// FUNCTION IMPLEMENTATION (MULTIPLE BUGS) | |
const isPalindrome = function(str) { | |
const noSpaces = str.split(" ").join(""); | |
console.log(noSpaces); | |
const midIndex = Math.floor(noSpaces.length/2); | |
const lastIndex = noSpaces.length - 1; | |
for (let i = 0; i < midIndex; i++) { | |
// console.log(str[i]) | |
// console.log(str[lastIndex - i]) |
This file contains 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
/* | |
* Write a function that joins the contents of conceptList together | |
* into one String, concepts, with each list item separated from | |
* the previous by a comma. | |
* | |
* To implement this we'll create a joinList function which will take | |
* in any array of strings return a comma-separated string. | |
*/ | |
let joinList = function(list) { |
This file contains 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
const calculateSalesTax = function(salesData, taxRates) { | |
const results = {}; | |
// Iterate through each company in the list | |
for (let i = 0; i <= salesData.length - 1; i++) { | |
// Initialize results object if it doesn't exist. | |
if (!results[salesData[i]['name']]) { | |
results[salesData[i]['name']] = { totalSales: 0, totalTaxes: 0 }; |
This file contains 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
const students = [ | |
{ id: 1, name: "bruce", age: 40 }, | |
{ id: 2, name: "zoidberg", age: 22 }, | |
{ id: 3, name: "alex", age: 22 }, | |
{ id: 4, name: "alex", age: 30 } | |
]; | |
const students2 = [ | |
{ id: 1, name: "Frank", age: 100 }, | |
{ id: 2, name: "Jay", age: 22 }, | |
{ id: 3, name: "Frank", age: 22 }, |
This file contains 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
const library = { | |
tracks: { t01: { id: "t01", | |
name: "Code Monkey", | |
artist: "Jonathan Coulton", | |
album: "Thing a Week Three" }, | |
t02: { id: "t02", | |
name: "Model View Controller", | |
artist: "James Dempsey", | |
album: "WWDC 2003"}, | |
t03: { id: "t03", |
This file contains 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
const sum = function(fromN, toN) { | |
if (fromN === toN) { | |
return toN; | |
} else { | |
return fromN + sum(fromN + 1, toN); | |
} | |
}; | |
module.exports = sum; |
This file contains 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
class Vampire { | |
constructor(name, yearConverted) { | |
this.name = name; | |
this.yearConverted = yearConverted; | |
this.offspring = []; | |
this.creator = null; | |
} | |
/** Simple tree methods **/ |
This file contains 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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<style> | |
body { | |
margin: 0px; | |
padding: 0px; | |
} | |
</style> | |
</head> |
OlderNewer