Skip to content

Instantly share code, notes, and snippets.

@mattswann
Last active August 29, 2015 14:17
Show Gist options
  • Select an option

  • Save mattswann/50d31d7b71a9fd159d14 to your computer and use it in GitHub Desktop.

Select an option

Save mattswann/50d31d7b71a9fd159d14 to your computer and use it in GitHub Desktop.

###REVERSE STRING

Create a function named "reverse" for the String prototype that will allow the following functionality:

EXAMPLE:

"String".reverse();         //=> returns "gnirtS"
"I like cookies".reverse(); //=> "seikooc ekil I"

HINT: To add functions to the the STRING prototype use the following syntax:

String.prototype.myCoolFunction = function(){
  console.log("You only had one job! To the naughty desk!");
  }
  
"I forgot the hook".myCoolFunction() #=> "You only had one job! To the naughty desk!"

###PALINDROME


A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward or forward.

Write a function named "palindrome" that accepts one parameter, a STRING. If the word is a palindrome return true, if not return false.

EXAMPLE:

palindrome("Glenn") #=> false palindrome("Anna") #=> true

Make a list of words and test your program

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment