欢迎光临散文网 会员登陆 & 注册

路飞k8s面授同步班

2022-10-29 00:10 作者:绿兔子2  | 我要投稿

引用类型存储的是变量的地址,赋值仅仅是地址的拷贝

var a = 1function increase( num ){    return num += 1}increase( a )console.log( a )  // 1

JavaScript 中引用类型即对象,对象存储方式是,栈内存中存储地址,堆内存中存储数据

var obj = { a: 1 }function increase( obj ){    obj.a += 1}increase( obj )


路飞k8s面授同步班的评论 (共 条)

分享到微博请遵守国家法律