Skip to content

Instantly share code, notes, and snippets.

@youngjinmo
Last active November 13, 2018 07:14
Show Gist options
  • Save youngjinmo/c195763c1e62f91cfb8b4f9be1722dc4 to your computer and use it in GitHub Desktop.
Save youngjinmo/c195763c1e62f91cfb8b4f9be1722dc4 to your computer and use it in GitHub Desktop.
Quiz 5-2 in Intro to JavaScript in Udacity
/*
* Programming Quiz: Laugh it Off 2 (5-2)
*
* Write a function called `laugh` with a parameter named `num` that represents the number of "ha"s to return.
*
*/
var num=0;
function laugh(num){
var str="";
for(var i=0; i<num; i++){
str += "ha";
}
return str+"!";
}
console.log(laugh(3));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment