我有一个 JavaScript 函数:
function test(a, b, c) {
if(typeof b == "undefined")
//do something
//function code
}
现在我想以这样的方式调用此函数,以便 typeof b 保持未定义
且 a & c contains
值(无需重新排序 a
、b
和 c
),例如
test("value for a", what i can pass here so that b type will be undefined, "value for c")
最佳答案
只需传递undefined
(不带引号):
test("value for a", undefined, "value for c");
关于javascript - 使用未定义的值调用 JavaScript 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10993648/