javascript - js string data type, what does this expression mean?
迷茫
迷茫 2017-06-30 09:52:31
0
1
710

JS string data type, what does this expression mean? Didn't understand much.

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(1)
大家讲道理
  • First of all, there is a typo, it should be "雷一" should be "another", and "wear piece" should be "create".

  • He was not very clear when describing this paragraph. In fact, all his descriptions here are based on the memory space, that is to say:

    • In JS, the memory space of a string cannot be modified directly once it is created. If you need to change the value of a variable, you must first destroy the originally allocated memory space, reallocate the memory space and fill it with a new value.

    • So, his explanation of the code refers to var lang = 'java'This creates a string value, and the memory space corresponding to this value cannot be changed, lang = lang + 'script'When the value is reassigned here The operation is:

      • First open up a new memory space of 10 characters

      • Fill the original lang value memory space and the 'script'string memory space correspondingly into this 10-character memory space

      • Destroy the two spaces that originally stored lang and 'script'strings

      • Assign the newly opened and filled space of 10 characters to the variablelang

  • If your understanding is based on the appearance you can see (such as string variables and the like), then you must have been fooled by the author's excessive omissions.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!