Setting a variable to undefined

Posted by AJ on Stack Overflow See other posts from Stack Overflow or by AJ
Published on 2010-02-10T09:20:04Z Indexed on 2010/04/13 16:43 UTC
Read the original article Hit count: 316

Filed under:

Hello,

I'm a bit confused about Javascript undefined & null.

Firstly what does if (!testvar) actually do? Does it test for undefined and null or just undefined?

Secondly, once a variable is defined can I clear it back to undefined (therefore deleting the variable).

Thirdly, can I pass undefined as a parameter? e.g:

function test(var1, var2, var3) {
}

test("value1", undefined, "value2")

Thanks,

AJ

© Stack Overflow or respective owner

Related posts about JavaScript