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

Wednesday, December 5, 2012

Codecademy: Codeyear Building 'substring' With Recursion (Part 2)


//sample solution

var substring = function(all, start, end){
//Base case
if(start >= end){
console.log(all[start]);
} else {
//Recursive case
console.log(all[start]);
substring(all,start+1,end);
}
};

//test
substring("lorem ipsum dolor",6,10);

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts