Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand the original value and reference value of JS

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "how to understand the original value and reference value of JS". In daily operation, I believe many people have doubts about how to understand the original value and reference value of JS. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubt of "how to understand the original value and reference value of JS". Next, please follow the editor to study!

Original value-> basic type

Number String Boolean undefined null

Simple segments of data stored in the stack, that is, their values are stored directly in the location where the variable is accessed

Dynamic language-> scripting language-> interpretive language-> weakly typed language

Static language-> compiled language-> strongly typed language

Null null initialization component function destroys function occupies space

Reference value

Object array function date RegExp

If a value is of a reference type, its storage space is allocated from the heap. Because the size of the reference value changes, it cannot be placed on the stack, otherwise it will slow down the speed of variable lookup. Instead, the value placed in the stack space of the variable is the address where the object is stored in the heap. The size of the address is fixed, so storing it on the stack does not have any negative impact on variable performance.

Ex

D1 var arr1 = [1jin2jin3 var arr1 4]; var arr2 = arr1; / / arr1.push (5); / / print arr2 as 1jing2jing3 arr1 = [1jing2]; / / re-assign will not affect arr2 [xss_clean] (arr2); at this point, the study on "how to understand the original values and reference values of JS" is over, hoping to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report