gpt4 book ai didi

javascript - ES6 js 关键字作为参数的精确行为

转载 作者:搜寻专家 更新时间:2023-10-31 23:32:08 25 4
gpt4 key购买 nike

我有一个代码,预计会返回“未定义”或任何错误,但它会提供所提到的输出。

let i = (x, c) => {
c(x);
};

i(20, (undefined) => {
let j = undefined;
console.log(j);
});


function y(undefined) {
let a = undefined;
console.log(a);
}
y(90);

如果在函数参数中使用保留字如何工作和改变行为?

最佳答案

undefined 不是保留字。

它是一个全局的只读变量。

没有什么能阻止您在更小的范围内定义另一个同名变量。

关于javascript - ES6 js 关键字作为参数的精确行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56802846/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com