Skip to content

Instantly share code, notes, and snippets.

@sethschori
Forked from anonymous/Name Games (1.4).js
Created July 31, 2016 17:26
Show Gist options
  • Save sethschori/cfaeae0a4c5abd3f74b043d9e2e75ae2 to your computer and use it in GitHub Desktop.
Save sethschori/cfaeae0a4c5abd3f74b043d9e2e75ae2 to your computer and use it in GitHub Desktop.
https://repl.it/CSoW/81 created by sethopia
/*
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
playNameGame("Daniel") ==> "Daniel Daniel Bo Baniel Banana Fana Fo Faniel Fee Fi Mo Maniel Daniel"
*/
function sayMyName (fname, lname) {
console.log("My name is",fname,lname);
}
function playNameGame (fname) {
var stem = fname.slice(1);
console.log(fname,fname,"Bo B"+stem,"Banana Fanana Fo F"+stem,"Fee Fi Mo M"+stem,fname);
}
sayMyName("Dan", "The Man");
playNameGame("Daniel");
playNameGame("Seth");
Native Browser JavaScript
>>> My name is Dan The Man
Daniel Daniel Bo Baniel Banana Fanana Fo Faniel Fee Fi Mo Maniel Daniel
Seth Seth Bo Beth Banana Fanana Fo Feth Fee Fi Mo Meth Seth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment