Skip to content

Instantly share code, notes, and snippets.

View emothek's full-sized avatar
🏠
Working from home

Mokhtar Megherbi emothek

🏠
Working from home
View GitHub Profile
highestProductOf3 = function (arrayOfInts) {
if(arrayOfInts.length < 3){ // if provided array has less than 3 values then return false
console.log('Less than 3 items!');
return false;
}
// we're going to start at the 3rd item (at index 2)
// so pre-populate highests and lowests based on the first 2 items.