Last active
February 19, 2019 10:30
-
-
Save jfraboni/c79f19d235c392b30adcb1363fdebf46 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// More Efficient | |
function compareAll(bodies) { | |
// loop thru all bodies backwards : ignore first item // | |
for(let i = active.length - 1; i > 0; i--) { | |
// pull out bodyA for comparison // | |
const bodyA = active[i]; | |
// loop thru all bodies backwards : start at j = i - 1 and include first item // | |
for(let j = i - 1; j > -1; j--) { | |
// pull out bodyB for comparison // | |
const bodyB = active[j]; | |
// ompare bodyA to bodyB... | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment