Fourth: variables, ranges, and memory issues
Test Type: typeof is the best tool for determining whether a variable is a string, a numeric value, a Boolean, or a undefined . But assuming that the value of the variable is an object or null,typeof only returns "object", using the when the typeof detects a function. "function" is returned.
If the reference data type is checked. can use the instanceof operator, the reference type used is an instance of Object.
Garbage collection
1. Mark Clear (mark-and-sweep)
2. reference count (reference counting)
Managing Memory
The amount of available memory allocated to a Web browser is typically less than that allocated to a desktop application. This is due to security considerations. Prevents The Web page that executes JS from exhausting all system memory and causing the system to crash.
Once the data is no longer practical. It is best to release the reference by setting its value to null . This is the dereference. The real function of dereferencing is to leave the value out of the execution environment , so the next time the garbage collector is run, it is recycled.
Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.
JavaScript Advanced Programming Reading notes (iii) variables, scope, and memory issues