为什么说js中Number是不可变量这是《Javascript - The Definite Guide 6th》正文30页的原文.“ They can also be categorized as mutable and immutable types.A value of a mutable type can change.Objects and arrays are mutable:a JavaScript
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/27 17:20:17
![为什么说js中Number是不可变量这是《Javascript - The Definite Guide 6th》正文30页的原文.“ They can also be categorized as mutable and immutable types.A value of a mutable type can change.Objects and arrays are mutable:a JavaScript](/uploads/image/z/10605392-8-2.jpg?t=%E4%B8%BA%E4%BB%80%E4%B9%88%E8%AF%B4js%E4%B8%ADNumber%E6%98%AF%E4%B8%8D%E5%8F%AF%E5%8F%98%E9%87%8F%E8%BF%99%E6%98%AF%E3%80%8AJavascript+-+The+Definite+Guide+6th%E3%80%8B%E6%AD%A3%E6%96%8730%E9%A1%B5%E7%9A%84%E5%8E%9F%E6%96%87.%E2%80%9C+They+can+also+be+categorized+as+mutable+and+immutable+types.A+value+of+a+mutable+type+can+change.Objects+and+arrays+are+mutable%3Aa+JavaScript)
为什么说js中Number是不可变量这是《Javascript - The Definite Guide 6th》正文30页的原文.“ They can also be categorized as mutable and immutable types.A value of a mutable type can change.Objects and arrays are mutable:a JavaScript
为什么说js中Number是不可变量
这是《Javascript - The Definite Guide 6th》正文30页的原文.“ They can also be categorized as mutable and immutable types.A value of a mutable type can change.Objects and arrays are mutable:a JavaScript program can change the values of object properties and array elements.Numbers,booleans,null,and undefined are immutable—it doesn’t even make sense to talk about changing the value of a number,for example.”为什么说Number,boolean是不可变量?这里的可变与不可变是什么意思?
为什么说js中Number是不可变量这是《Javascript - The Definite Guide 6th》正文30页的原文.“ They can also be categorized as mutable and immutable types.A value of a mutable type can change.Objects and arrays are mutable:a JavaScript
这里的“不可变”指的是变量本身是不会发生变化的.数字、布尔值都属于“原子”数据类型.你只能改变它的值,而不能改变它本身.而对象则不同.对象是复杂的数据类型,一个对象会包含很多原子类型或者其他的对象.你可以改版对象的属性方法,但对象还是它本身.