Categorising a number in JavaScript
You might not need to loop through an object, and a simple switch statement would suffice.

function getSize(number) {
    switch (true) {
        case number &lt; 100: return "url_t";
        case number &lt; 240: return "url_s";
        case number &lt; 320: return "url_n";
        case number &lt; 500: return "url_m";
        case number &lt; 640: return "url_z";
        case number &lt; 800: return "url_c";
        default:           return "url_l";
    }
}


As a side note, I've seem people use switch (true) before when they want to use some logic in their case's instead of just hard coded values. Kind of a nice alternative to an if-else construct, and would probably perform better than looping over an object using a for-in loop.

You could still keep the sizes in an object:

var sizes = {
    100 : 'url_t',
    240 : 'url_s',
    320 : 'url_n',
    500 : 'url_m',
    640 : 'url_z',
    800 : 'url_c',
    1024 : 'url_l'
};

function getSize(number) {
    switch (true) {
        case number &lt; 100: return sizes[100];
        case number &lt; 240: return sizes[240];
        case number &lt; 320: return sizes[320];
        case number &lt; 500: return sizes[500];
        case number &lt; 640: return sizes[640];
        case number &lt; 800: return sizes[800];
        default:           return sizes[1024];
    }
}


Edit: A problem arises if you need to change the sizes for your application. That's why I'm leaning towards the first function, which just a switch statement and hard coded values.