I want to see if my javascript object is of a certain type.
I have no object that I can not edit this object.) And I have created examples of that object. Now I want to loop through all the objects that are available at any point and find out which are the examples. MyObject = function () {}; Var obj_person = new myObject ();
Now if I write
typeob obj_person
it gives me object
I can not use the instanceof
which is not useful because it does not work in IE8.
Is it anyway to check whether obj_person is an example of my object?
Thank you.
EDITED * * *
Here is the code
var arr_instances = []; For (window in var v) {var obj_required; If (type window [v] == 'object') {obj_required = window [v]; If (obj_required.imgSrc) {arr_instances.push (obj_required); }}}
Then I can iterate arr_instance and can do whatever I want to do.
for (var i = 0; i & lt; arr_instances.len; I ++) {if (arr_instances [i] .imgSrc == 'IMG.jpg required') {arr_instances [I] .imgSrc = 'newImg.jpg'; }}
Comments
Post a Comment