Thuộc tính tĩnh dài của hàm dựng, hàm và đối tượng là gì?Thuộc tính độ dài của các hàm tạo hàm, mảng và đối tượng là gì?
Phương pháp tĩnh có ý nghĩa nhưng về độ dài của thuộc tính tĩnh thì sao?
Object.getOwnPropertyNames(Array)
["length", "name", "arguments", "caller", "prototype", "isArray"]
Object.getOwnPropertyNames(Function)
["length", "name", "arguments", "caller", "prototype"]
Lưu ý: Tôi nhận được câu trả lời về thuộc tính độ dài của Function.prototype không được hỏi tại đây.
Object.getOwnPropertyNames(Function.prototype)
["length", "name", "arguments", "caller", "constructor", "bind", "toString", "call", "apply"]
Object.getOwnPropertyNames(Object)
["length", "name", "arguments", "caller", "prototype", "keys", "create", "defineProperty", "defineProperties", "freeze", "getPrototypeOf", "getOwnPropertyDescriptor", "getOwnPropertyNames", "is", "isExtensible", "isFrozen", "isSealed", "preventExtensions", "seal"]
ECMA-262 3rd edition, phần * 15.2.3 *, * 15.3.3 * và * 15.4.3 * xác định rằng tất cả các nhà xây dựng có một 'tài sản length', có giá trị là 1. – DCoder
Cám ơn làm rõ :) nhưng tại sao 1 lý do cụ thể? –