'Unable to get property 'length' of undefined or null reference in jquery.min.js
i am using arborjs0.92 version.when i run ie10 it show on Unable to get property 'length' of undefined or null reference in jquery.min.js. how can i solve this issue.
Solution 1:[1]
You can use if statement. If object is null then length is 0 otherwise get the length by using length property of that object.
Solution 2:[2]
Before using .length property, check whether the variable is null/undefined/or some other falsy value. If Yes then assign length 0 else calculate the length. Eg :
var reference, // ref is undefined
refLength;
if(reference) {
refLength = reference.length;
}
else {
refLength = 0;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Praloy Das |
| Solution 2 | M J |
