I have this in my javascript:
console.log(filters);
console.log('----');
console.log(filters.max_price);
In Chrome, it shows this. This is the expected behavior.
Object {max_price: undefined, sort_by: undefined, distance: undefined, start: undefined, num: undefined}
----
undefined
In IE8, the log shows this:
LOG: Object Object
----
LOG: String
Why does IE8 think it is a string? I need to know if it's undefined.
I have lots of code that sets default values.
if(typeof filters.max_price == undefined){ //I use this technique a lot!
filter.max_price = 2000;
}
How can I check for undefine-ds in IE8? Should I do this? This seems to work (yay...), but it seems cheap and hacky.
if(!filters.max_price || typeof filters.max_price == 'undefined'){
Is there a simple way I can do this with underscore?