I’m looping through an array in JavaScript to check for null in each object using jQuery, what would be the best cross browser solution for this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
nullis pretty reliablynull. If you don’t care specifically aboutnull– that is, if you’d do the same thing when something isundefinedas you would when it’snullor any other “falsy” value, you can just useHowever that’s not safe if you’re data is numeric, because zero is “falsy”, or if they’re strings where an empty string should not count as “empty” in the array, for the same reason. Thus you can compare with the double-equals comparator to
nullI’ve never heard of any cross-browser issues with this.