Skip to content

Instantly share code, notes, and snippets.

@biglovisa
Last active February 9, 2016 15:57
Show Gist options
  • Save biglovisa/ddfbe08f2ef4f3a895f5 to your computer and use it in GitHub Desktop.
Save biglovisa/ddfbe08f2ef4f3a895f5 to your computer and use it in GitHub Desktop.
js-challenge-1
//------------------------------------------------------------- Split the string on new lines
var text = "What are you talking about?"
split(text);
// #=> ["What", "are", "you", "talking", "about?"]
//------------------------------------------------------------- Reverse the order of the words
var text = "What are you talking about?"
reverseOrder(text);
// #=> "about talking you are What?"
//------------------------------------------------------------- Word mashup
var text = "Turing School"
mashup(text);
// #=> "Suring Tchool"
//------------------------------------------------------------- Blurred doubles
// Write a function that replaces any double letters in a word with asterisks.
// For example, ball becomes ba**.
word = "apple"
blurred(word);
// #=> a**le
// The function also accepts an array of words
words = ["apple", "pear", "school"]
blurred(words);
// #=> ["a**le", "pear", "sch**l"]
//------------------------------------------------------------- Pig German
// Write a function that translates the sentence to Pig German.
// Given the word "burrito", Pig German works like this:
// 1. take the first letter of the word and put it at the end of the word: urritob
// 2. append the syllable 'all' to the word: urritoball
var text = "What are you eating?"
pigGermanize(text);
// #=> "hatwall reaall ouyall atingeall?"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment