getMemory
Estimates the memory usage of a value in bytes and returns a human-readable string representing the size.
Parameters
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
value | any | false | The value whose memory usage is to be estimated. This can be an Object, string, number, boolean, or an Array. |
Returns
Example
getMemory("John"); // "8.00 Bytes"
getMemory(12); // "8.00 Bytes"
getMemory(true); // "4.00 Bytes"
getMemory(["John", 12]); // "16.00 Bytes"
getMemory({ name: "John", age: 12 }); // "16.00 Bytes"