krycek
11-04-2002, 09:37 PM
Ok, I was always under the impression that if you want to check if an object exists, you just say if (myObject) ... etc.
However that does not work for me right now! :confused:
My code is very simply:
if (collection) {
// do actions based on collection
}
collection in this case is an array which holds a list of the names of certain objects. This is set up in one script file, which may not always be present when the second script file, containing a checking function, is. The checking function should loop through the collection array, checking the objects.
However, if I do not include the file that sets up collection as an array, I get an error: collection is undefined. That is expected, so I inserted the code above, to check if collection exists first!
Same error! :eek:
So... anyone... what am I doing wrong...? I am sure it is simple but I can't see it! (I am sure things have always worked this way in the past!)
Cheers people!
::] krycek [::
However that does not work for me right now! :confused:
My code is very simply:
if (collection) {
// do actions based on collection
}
collection in this case is an array which holds a list of the names of certain objects. This is set up in one script file, which may not always be present when the second script file, containing a checking function, is. The checking function should loop through the collection array, checking the objects.
However, if I do not include the file that sets up collection as an array, I get an error: collection is undefined. That is expected, so I inserted the code above, to check if collection exists first!
Same error! :eek:
So... anyone... what am I doing wrong...? I am sure it is simple but I can't see it! (I am sure things have always worked this way in the past!)
Cheers people!
::] krycek [::