What performance advantage does using Object.keys().length have over Object.entries() when only checking the number of properties?
Using Object.keys().length has a performance advantage over Object.entries() when only checking the number of properties because it doesn't need to create arrays of key-value pairs in memory. While Object.keys() still creates an array of all the keys, Object.entries() creates a more complex array structure containing arrays of [key, value] pairs for each property. This requires more memory allocation and processing. For simply counting properties, even better alternatives exist: 1) Object.keys(obj).length, 2) Object.getOwnPropertyNames(obj).length (which also includes non-enumerable properties), or 3) Using a manual counter with a for...in loop (though this includes properties from the prototype chain unless checked). The performance difference becomes more significant with objects that have many properties or complex values.