Skip to content

Instantly share code, notes, and snippets.

@Underdoge
Last active February 24, 2017 02:26
Show Gist options
  • Save Underdoge/435873ba3d683667b561c38c5a1f1fd6 to your computer and use it in GitHub Desktop.
Save Underdoge/435873ba3d683667b561c38c5a1f1fd6 to your computer and use it in GitHub Desktop.
adjacentElementsProduct
function adjacentElementsProduct(inputArray) {
var i=0,x=inputArray[i]*inputArray[i+1];
i++;
while(i+1<inputArray.length){
if(inputArray[i]*inputArray[i+1]>x)
x=inputArray[i]*inputArray[i+1];
i++;
}
return x;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment