Primitive values -> primitive types Simple data segments stored on the stack, that is, their values are stored directly at the location where the variable is accessed Dynamic language -> scripting language -> interpreted language -> weakly typed language Static language -> compiled language -> strongly typed language null empty value initialization component function destruction function placeholder Reference Value If a value is of a reference type, its storage is allocated from the heap. Since the size of the reference value will change, it cannot be placed on the stack, otherwise it will slow down the variable search. Instead, the value placed in the variable's stack space is the address where the object is stored on the heap. The address size is fixed, so storing it on the stack has no negative impact on the variable's performance. <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>D1</title> </head> <body> <script type="text/javascript"> var arr1 = [1,2,3,4]; var arr2 = arr1; //arr1.push(5); //At this time, arr2 is printed as 1, 2, 3, 4, 5 arr1 = [1,2]; //Reassigning value will not affect arr2 document.write(arr2); </script> </body> </html> This is the end of this article about JS original value and reference value. For more relevant JS original value and reference value content, please search 123WORDPRESS.COM’s previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Introduction to vim plugin installation under Linux system
>>: How to change the color of the entire row (tr) when the mouse stops in HTML
<meta http-equiv="x-ua-compatible" co...
The use of Vue+ElementUI Tree is for your referen...
1. After installing MySQL 5.6, it cannot be enabl...
An index is a sorted data structure! The fields t...
For Centos installation of MySQL, please refer to...
<br />We usually declare DOCTYPE in HTML in ...
Preface Everyone should be familiar with the watc...
Copy code The code is as follows: 1. Sina Weibo &...
Table of contents Preliminary Notes Problem Repro...
This article mainly explains how to deploy Elasti...
When applying docker containers, we often mount t...
This article shares the specific code of js to im...
The basic structure of HTML hypertext documents is...
Copy code The code is as follows: <!DOCTYPE HT...
A jQuery plugin every day - stacked menu, for you...