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
/* | |
NICKNAME GENERATOR | |
Write a naive nickname generator function that takes a name and returns the first 3 or 4 letters (4 letters if the 3rd is a vowel) | |
eg nickName("daniel") ==> 'dan' | |
nickName("Beowulf") ==> 'Beow' | |
*/ | |
function nickName(name) { |
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
/* | |
SEASONS OF LOVE | |
Complete the function so it generates the numbers of minutes in a year and logs that number to the console. | |
*/ | |
var seasonsOfLove = function() { | |
var minutesInDay = 60*24; | |
var daysInYear = 365; | |
return minutesInDay * daysInYear; |
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
/* | |
ROUND TOWN | |
We will look at 3 Math functions in some depth: | |
Math.floor(x) | |
Math.ceil(x) | |
Math.round(x) | |
Math.floor() returns the largest integer less than or equal to a given number. | |
ex) |
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
/* | |
OPEN SESAME | |
Our gate function is not very secure. Choose a password from the passwords array (or write your own and add it to the array). Then, uncomment and complete the if statement and foor loop so the gate only logs an entry message when the designated password is selected by the loop | |
*/ | |
var passwords = [ | |
'Password123', |
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
/* | |
UP & DOWN | |
Create a function countUpThenDown() that takes a number n and logs all the numbers 0 to n and back to 0. | |
eg) | |
countUpThenDown(2) ==> 0 1 2 1 0 | |
countUpThenDown(11) ==> 0 1 2 3 4 5 6 7 8 9 10 11 10 9 8 7 6 5 4 3 2 1 0 | |
*/ |
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
/* | |
HOLY CRAPS | |
We're creating a simplified verison of the popular casino game craps. | |
A player rolls 2 dice. If the total of those dice is 7 or 11, the player wins, | |
otherwise he or she must add more money to the betting pool and roll again | |
Complete the while loop and run your code to play some craps! | |
*/ |
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
/* | |
Thoughtful Thursdays - RPS | |
*/ | |
function rockPaperScissors(hand1, hand2) { | |
// hand1 equals hand2, return 'tie' | |
if (hand1 === hand2) { | |
return 'TIE'; | |
} | |
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
/* | |
NAME GAMES | |
Create two functions, sayMyName() and playNameGame() | |
sayMyName() will take 2 arguments: a first name and a last name. It will log out the string "My name is FIRSTNAME LASTNAME" | |
sayMyName("Dan", "The Man") ==> "My name is Dan The Man" | |
playNameGame() will take a person's first name. It will log out a string of the name game song |
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
/* | |
BLOOD ALCOHOL CALC | |
An individual's BAC may be calculated as follows: | |
BAC% = (A × 5.14 / W × r) - 0.15 × H | |
A: Total alcohol consumed, in ounces (oz) | |
W: Body weight, in pounds (lbs) | |
r: The alcohol distribution ratio, 0.73 for man, and 0.66 for women | |
H: Time passed since drinking, in hours |
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
/* | |
TRANSPOSE MUSIC | |
In music a keyboard has the following notes | |
[A, A#, B, C, C#, D, D#, E, F, F#, G, G#] | |
A # is "sharp" notation. A# or A sharp, is in between A and B | |
Create a function transpose() that takes an array of notes and a string with the number of steps. The function should return an array with all the notes in the array transposed up that many steps |
OlderNewer