I'd like to check for a variable within my array. It works if the number matches my value directly. How can I get it to match the previous value if it's below the match. From my code :
var assassin_bp = {
fhr: { 7:8, 15:7, 27:6, 48:5, 86:4, 200:3 },
fcr: { 8:15, 16:14, 27:13, 42:12, 65:11, 102:10, 174:9 }
}
var char_fhr = 48;
var fhr_frames = assassin_bp[ 'fhr' ][ [char_fhr] ]
with char_fhr worth 48, fhr_frames returns 5,
if char_fhr was worth 47 (or any number from 27 to 47), fhr_frames should return 6,
if char_fhr was worth 49 (or any number from 48 to 85), fhr_frames should return 5
I'm clueless on where to start. Can an object include a range? Should I have a function checking for it?
[]
around thechar_fhr
variable. Harmless in this exact situation, but should probably be removed.