JavaScript Advanced Programming Reading notes (iii) variables, scope, and memory issues

Source: Internet
Author: User
Tags numeric value

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.