is there any way to get the memory address of the JavaScript variable , cause when comparing things like [1,2,3] === [1,2,3] which is looks like true but it is false , and also this memory address will help me to understand mutable and immutability of strings too
1 Answer
JavaScript itself is meant to be implementation-agnostic, so concepts like memory addresses are intentionally absent from the language itself. Outside of the language, you can use the browser's debugging tools to take a memory snapshot, and that might contain the information. Note, however, that there is no real guarantee that an object will retain its address.
1 Comment
Community
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
looks like trueonly to the uninitiated :p[1, false, 4n, "hello"].toString() === [1, false, 4n, "hello"].toString()