Actually taken from the JS v1.4 Guide and modified to be a little more useful:
function showme(obj, obj_name) { var result = "" var null_list = ""; obj_name = (obj_name != '')? obj_name: 'obj'; for (var i in obj) { if(obj[i] != null && obj[i] != '') result += obj_name + "." + i + " = " + obj[i] + "\n"; else null_list += i + ", "; } return result + "\n NULL propertys: \n" + null_list; }
Pass it an object you want to see the properties of and it will show them to you. Like so:
alert(showme(item[i]));
0 Responses to “handy Javascript debugging function”
Leave a Reply