Created
December 7, 2015 15:37
-
-
Save anonymous/1963aa85d2595ed0b644 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/mattnwa 's solution for Bonfire: Where do I belong
This file contains 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
// Bonfire: Where do I belong | |
// Author: @mattnwa | |
// 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) { | |
// Find my place in this sorted array. | |
arr.push(num); | |
arr.sort(function(a,b){ | |
return a-b; | |
}); | |
return arr.indexOf(num); | |
} | |
where([10, 20, 30, 40, 50], 35); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment