Wednesday, August 9, 2017

Caesars Cipher




One of the simplest and most widely known ciphers is a Caesar cipher, also known as a shift cipher. In a shift cipher the meanings of the letters are shifted by some set amount.
A common modern use is the ROT13 cipher, where the values of the letters are shifted by 13 places. Thus 'A' ↔ 'N', 'B' ↔ 'O' and so on.
Write a function which takes a ROT13 encoded string as input and returns a decoded string.
All letters will be uppercase. Do not transform any non-alphabetic character (i.e. spaces, punctuation), but do pass them on.

Tuesday, August 8, 2017

Seek & Destroy


Return the lowest index at which a value (second argument) should be inserted into an array (first argument) once it has been sorted. The returned value should be a number.
For example, getIndexToIns([1,2,3,4], 1.5)should return 1 because it is greater than 1(index 0), but less than 2 (index 1).
Likewise, getIndexToIns([20,3,5], 19)should return 2 because once the array has been sorted it will look like [3,5,20] and 19 is less than 20 (index 2) and greater than 5 (index 1).
Remember to use Read-Search-Ask if you get stuck. Write your own code.

Monday, August 7, 2017

Falsy Bouncer




  • Remove all falsy values from an array.



  • Falsy values in JavaScript are false, null, 0, "", undefined, and NaN.



  • Remember to use Read-Search-Ask if you get stuck. Write your own code.


Here are some helpful links:

Boolean Objects
Array.prototype.filter()  

Saturday, August 5, 2017

Slasher Flick



Return the remaining elements of an array after chopping off n elements from the head.
The head means the beginning of the array, or the zeroth index.


#perfect

Friday, August 4, 2017

freecodecamp: Chunky Monkey



Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a two-dimensional array.