Skip to content

Instantly share code, notes, and snippets.

@mtroiani
Created December 12, 2015 19:20
Show Gist options
  • Save mtroiani/bef2bfe52ff268c68aa0 to your computer and use it in GitHub Desktop.
Save mtroiani/bef2bfe52ff268c68aa0 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/mtroiani 's solution for Bonfire: Where do I belong
// Bonfire: Where do I belong
// Author: @mtroiani
// Challenge: http://www.freecodecamp.com/challenges/bonfire-where-do-i-belong
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function where(arr, num) {
arr.push(num);
arr = arr.sort(function(a, b) {
return a - b;
});
var result = arr.indexOf(num);
return result;
}
where([40, 60], 50);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment