Skip to content

Instantly share code, notes, and snippets.

@samusgray
Created June 4, 2015 20:19
Show Gist options
  • Select an option

  • Save samusgray/265fa30901445a28df9d to your computer and use it in GitHub Desktop.

Select an option

Save samusgray/265fa30901445a28df9d to your computer and use it in GitHub Desktop.
lint-this
var rev = function( string){
var reversedString = '';
for(var i = string.length -1; i >= 0; i--) {
reversedString += string[i]
}
return reversedString
}
string = 'Foo';
r1 = string.split('').reverse() .join("");
r2 = rev(string)
console.log(r1 == r2);
var add = function(a) {
return function(b) {
return a + b;
}
}
add(20)(20)
function factorial(n) {
var product = 1;
while ( n > 1 ) {
product *= n
n--;
}
return product
}
factorial(4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment