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
/* | |
A game of chess is played on an 8 column by 8 row board. | |
In the game of chess, a queen can attack pieces which are on the same row, column, or diagonal. | |
*/ | |
const generateBoard = (whiteQueen, blackQueen) =>{ | |
let board = []; | |
let hzl = []; | |
for(let i = 0; i < 8; i++){ | |
for(let j = 0; j < 8; j++){ |
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
/* | |
URL Encoded Strings | |
To safely send data in a URL, the data first has to be encoded to convert any | |
special characters to URL safe characters. For this assignment we will only focus on the following URL encoding rules: | |
%20 represents a space character. | |
Key-value pairs are represented using an = character: key=value | |
Multiple key-value pairs are separated using a & character | |
*/ | |
const urlDecode = function(text) { |
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
/* | |
Create a function named makeCase that will receive an input string and one or more casing options. | |
Return a new string that is formatted based on casing options: | |
Precedence of each of the casing styles are as follows, values higher in the list should be processed first: | |
camel, pascal, snake, kebab, title | |
vowel, consonant | |
upper, lower | |
*/ |
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
/* | |
Create a function named camelCase that will convert | |
a string to camel case, and return the result. | |
*/ | |
const camelCase = function(input) { | |
let string = input.split(""); | |
string[0] = string[0].toLowerCase(); | |
for(let i = 0; i < string.length; i++) { | |
if(string[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
/* | |
Create a function named squareCode that will receive a message, | |
and return the secret square code version of the message. | |
*/ | |
const squareCode = function(message) { | |
let len = Math.ceil(Math.sqrt(message.split(' ').join("").length)); | |
const messageWithoutSpace = message.split(' ').join(''); | |
let encrypted = ''; | |
for(let i = 0; i < len; 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
/* | |
Create a function named blocksAway that will receive an array of directions, | |
and return an object that calculates how far north and east those directions will take someone. | |
*/ | |
const blocksAway = function(directions) { | |
let origin = [0, 0]; | |
let finalPos = {}; | |
if(directions[0] === 'right'){ |
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
/* | |
In this kata you'll be responsible for setting up your JS file from scratch. Make sure it is well organized! | |
Write a guessing game where the user has to guess a secret number. After every guess the program | |
tells the user whether their number was too large or too small. At the end, the number of tries | |
needed should be printed. | |
Inputting the same number multiple times should only count as one try. If the user provides an answer | |
which isn't a number, print an error message and do not count this as a try. | |
*/ |
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
/* | |
Create a function named organizeInstructors that will receive an array of instructor objects, | |
and will return a new object that has the following format: | |
*/ | |
const organizeInstructors = function(instructors) { | |
let organize = {}; | |
instructors.forEach(i => { | |
if(!organize[i.course]){ | |
organize[i.course] = []; |
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
/* | |
Create a function named calculateChange that takes in a total amount of a bill and the total cash given to pay that bill. | |
Return a new object that describes the total amount of change for the cashier to give back. Omit any types of change | |
that you shouldn't give back, i.e. if you don't give back a twenty dollar bill, don't include it in the results. | |
*/ | |
const currencyDenominations = ['twenty', 'ten', 'five', 'two', 'one', 'quarter', 'dime', 'nickel', 'penny']; | |
const currencyValue = [2000, 1000, 500, 200, 100, 25, 10, 5, 1]; | |
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
/* | |
Create a function named talkingCalendar that takes in a date string with the format YYYY/MM/DD, | |
and returns a new human readable date that looks like December 2nd, 2017. | |
*/ | |
const getMonthName = (month) => { | |
const monthName ={ | |
01: 'January', 02: 'February', 03: 'March', | |
04: 'April', 05: 'May', 06: 'June', | |
07: 'July', 08: 'August', 09: 'September', |
NewerOlder