Quotes help make search much faster. Example: "Practice Makes Perfect"

Friday, May 12, 2017

FreeCodeCamp Repeat A String Repeat A String Sample Solution


function repeatStringNumTimes(str, num) {
  // repeat after me
  var temp='';
  if(num<=0){
    return '';
  } else {
    for(var i=0; i<num; i++){
      temp += str;
    }
  }
  return temp;
}

repeatStringNumTimes("abc", 3);

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts