Trying to learn javascript by reading underscore sourcecode and came across the below code:
var shallowProperty = function(key) {
return function(obj) {
return obj == null ? void 0 : obj[key];
};
};
var getLength = shallowProperty('length');
console.log(getLength('123'))//3
console.log('123'['length'])//3
console.log(getLength(['1','2']))//2
console.log(['1','2']['length'])//2
My question is, what is [length]
besides ['1','2']
? Any technical terms to call it? Where can we get the full list of keys/attributes available other than length
?