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
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <style> | |
| body { | |
| margin: 0px; | |
| padding: 0px; | |
| } | |
| </style> | |
| </head> |
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
| var 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 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
| function calculateDayInYear(date) { | |
| var splitDate = date.split('/'); | |
| var year = Number(splitDate[0]); | |
| var month = Number(splitDate[1]); | |
| var day = Number(splitDate[2]); | |
| var febDays = daysInFeb(year); | |
| var DAYS_IN_MONTH = [31, febDays, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; | |
| if (year && validMonth(month) && validDay(month, day)) { | |
| console.log(date, "is day", calculateDayNumber(month, day), "of the year", year); |
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
| function printInFrame(list) { | |
| var list = list.split(' '); | |
| var longest = longestStr(list).length; | |
| var leftBorder = '* '; | |
| var rightBorder = ' *'; | |
| var border = repeat('*', longest + leftBorder.length + rightBorder.length); | |
| console.log(border); | |
| for (let word of list) { |
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
| function isPalindrome(str) { | |
| var noSpaces = str.split(" ").join("").toLowerCase(); | |
| var mid = Math.floor(noSpaces.length/2); | |
| var last = noSpaces.length - 1; | |
| // console.log('str:', str); | |
| // console.log('noSpaces:', noSpaces); | |
| // console.log('mid:', mid); | |
| // console.log('last:', last); |
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
| function average(list) { | |
| var sum = 0; | |
| for (var num of list) { | |
| sum += num; | |
| } | |
| return sum / list.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
| var myArgs = process.argv.slice(2); | |
| function diceRollResult() { | |
| return Math.floor(Math.random() * 6) + 1; | |
| } | |
| function diceRoller(numberofRolls) { | |
| var result = ''; | |
| for (var i = 0; i < numberofRolls; i++) { | |
| if (i < numberofRolls -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
| var words = ""; | |
| var reverse = process.argv.splice(2); | |
| function latinRule(string) { | |
| var newString = ""; | |
| var stringArray = string.split(""); | |
| var firstLetter = ""; | |
| for (var i = 0; i < stringArray.length; i++) { | |
| if (i === 0) { | |
| firstLetter = stringArray[i]; |
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
| var words = process.argv.splice(2); | |
| function reverse(string) { | |
| var newString = ""; | |
| for (var i = string.length - 1; i >= 0; i--) { | |
| newString = newString + string[i]; | |
| } | |
| return newString; | |
| } | |
| for (var i = 0; i < words.length; i++) { |
NewerOlder