arrays - How to check that is list of objects or list of strings in javascript? -
does know how check list contain objects or strings?
in javascript arrays untyped, meaning: nothing take care of in it, if don't yourself.
since array composite structure addressed integer value, can check every address exact type stored inside. if array created else. however, array type if find objects, strings , int's in it?
other options:
- create own structure specify type on creation , throw error in
add(item)
method if items type violated - create own structure in
add(item)
take care of type , write in property of structure
Comments
Post a Comment