Js stack memory and heap memory

Javascript variables are divided into basic type values ​​and reference type values.

Basic type values ​​are stored in stack memory, while reference type values ​​are stored in heap memory

The basic type value is destroyed after the function is executed, and the reference type value will not be automatically destroyed when the external variables are still referenced. Only when all variables are no longer referenced, the Javascript garbage collection mechanism will be used. its destroyed

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325483730&siteId=291194637