Created
          May 29, 2016 01:02 
        
      - 
      
- 
        Save mihneawalker/5077053c591c05d45e322a89ea23143e to your computer and use it in GitHub Desktop. 
    freecodecamp
  
        
  
    
      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
    
  
  
    
  | function getIndexToIns(arr, num) { | |
| arr.sort(function (a,b){ | |
| return a-b; | |
| }); | |
| console.log(arr); | |
| for (var i=0; i < arr.length; i++) | |
| { | |
| if (num <= arr[i] ) | |
| { | |
| console.log("winner is ", i); | |
| return i; | |
| } | |
| } | |
| return i; | |
| } | |
| getIndexToIns([40, 60], 50); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment