Skip to content

Instantly share code, notes, and snippets.

// Use the various String methods we learned today to get the function to
// print 'Fullstack Academy of Code'
var printFullstack = function() {
var starterString = 'I made no lack of good code';
return starterString.charAt(16).toUpperCase() + "u" + starterString.charAt(10) + starterString.charAt(10) + "stack Academy of C" + starterString.slice(24);
}
console.log(printFullstack());
/*
Count by m
Write a function that takes three arguments: n (number), m(number) and direction (string). The function should count to n by intervals of m. If the direction string is "Up", the function should count up to n, if the string is "Down", it should count down. You can assume that both n and m will be greater than 0. Do not print numbers greater than n.
Please complete the problem in 2 ways:
1. Using a for loop
2. Using while a loop
count(10, 2, "Up")
// 2
/*
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
/*
FILTER FUN
Create a function myFilter(arr, filter) that takes an array of letters and a 'filter' character.
The function should return a new ordered array of every element in the input array that is after the 'filter' alphabetically. You can assume the characters will always be lower case
ex
myFilter(['b', 'w', 'a', 'p', 'v'] , 'c') ==> ['p', 'v', 'w']
*/
//Log 'Hello World' to the console in as convoluted and zany a way as possible!
//See some heroic examples in various languages here: http://codegolf.stackexchange.com/questions/4838/most-complex-hello-world-program-you-can-justify
//Define the function here
var helloWorld = function() {
var abc = 'abcdefghijklmnopqrstuvwxyz';
// declare the add function which will be used in decoderRing operations
function add(startingValue, argumentValue) {
/*
SHORT STACK
create a function shorten() that takes a number and an array of single-digit integers. shorten() should return the input number, with every digit from the array removed
ex)
shorten(1023, [1,2]) --> 03
shorten(1245267194821, [2,3,4]) --> 15671981
*/
/*
Pattern Master
create a function patternMaker() that takes two arguments: an integer n and a piece of data of any type. patternMaker() should return an array of the second argument, repeated n times
ex)
patternMaker(5, 'Boo') --> ['Boo', 'Boo', 'Boo', 'Boo', 'Boo']
patternMaker(3, ['cat', 'dog']) --> [['cat', 'dog'], ['cat', 'dog'], ['cat', 'dog']]
*/
/*
Power Up!
Create a function powerUp() that takes an integer as input. It should return a new number, created by summing each digit raised by a consecutive power
ex)
powerUp(761) --> 7^1 + 6^2 + 1^3 === 44
powerUp(100) --> 1^1 + 0^2 + 0^3 === 1
*/
/*
PERFECT NUMBERS
A 'Perfect' number is a number whose sum of their divisors equals exactly that number. The divisors do not include the number itself
ex)
6 is perfect because 1 + 2 + 3 === 6
16 is not perfect because 1 + 2 + 4 + 8 === 15
An "Abundant" number is a number whose sum of their divisors (exluding itself) is greater than that number
/*
1337 Translator
"Leet" or "1337" is a popular alternative alphabet used by internet geeks.
Create a translator function that takes a string and outputs that string translated to leet
Leet Codex:
A -> @
B -> 8