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

【Udemy排名第一的JavaScript课程】2023最新完整JavaScri

2023-02-15 11:10 作者:寄笺予春  | 我要投稿

课程重点:

1.在JS函数内部修改函数参数,基本类型和引用类型的区别。

const num= 6;

const person = {

name:"小红",

age:18

}

function change(value,obj){

value = 5;

obj.name = "小明";

}

change(num,person);

console.log(num); // 5

console.log(person); // name = "小明"

2.JS 只有按值传递,没有按引用传递。

But it's confusing ,because as we just learned for objects ,we do in fact pass in a reference. So the memory address of the object. However ,that reference itself is still a value. It's simply a value that contains a memory address. So basically we pass a reference to the function,but we do not pass by reference, and this is an important distinction.

3.学过c语言的胖友可能更懂按引用传递,咱还不是很懂。

【Udemy排名第一的JavaScript课程】2023最新完整JavaScri的评论 (共 条)

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