Recently, when writing code, I often encounter js variable assignment pointing to the same memory. Is there any way to avoid this problem?

recently, when writing code, I often encounter js variable assignment pointing to the same memory. Is there any way to avoid this problem?

Apr.04,2021

JavaScipt generally has three scalar types:: string (string, number (number), and boolean (Boolean). Reference types, object, array, and so on. Two special types: null and undefined.

The

scalar type assignment is a copy of copy, and then the assignment. The reference type points to the same memory.

usually there are more array and object assignments, which point to the same memory.


you can solve the problem by reading a good book and improving your knowledge.


immutable.js
but I don't think you'll have a problem with this. Your main problem is still too lame.


Let's code something. Since when can js operate memory? You didn't learn the reference type well.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3cf51-2c370.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3cf51-2c370.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?