Skip to content

Instantly share code, notes, and snippets.

@robotlolita
Created February 23, 2011 22:07
Show Gist options
  • Save robotlolita/841303 to your computer and use it in GitHub Desktop.
Save robotlolita/841303 to your computer and use it in GitHub Desktop.
function try_me (str) {
switch (str) {
case "foo": console.log("buu~"); break
case "bar": console.log("baz~"); break
default: console.log("bad, bad argument, no cookies for you.") }
}
try_me("foo") // "buu~"
try_me("bar") // "baz~"
try_me("nou") // "bad, bad argument, no cookies for you."
try_me() // "bad, bad argument, no cookies for you."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment