Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
36
rated 0 times [  38] [ 2]  / answers: 1 / hits: 44681  / 13 Years ago, tue, april 26, 2011, 12:00:00

Given:



console.log(boo); this outputs undefined


Given:



var boo = 1;
console.log(boo); this outputs 1


After defining boo and setting to 1, how can I then reset boo, so that console.log outputs undefined?



Thanks


More From » javascript

 Answers
15

delete boo



Don't use var boo = undefined. undefined is just a variable and if someone sets undefined = hello then you'll be getting hello everywhere :)



EDIT:



null wasn't same as undefined. removed that bit.


[#92551] Monday, April 25, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
benitoh

Total Points: 150
Total Questions: 113
Total Answers: 104

Location: India
Member since Wed, Aug 26, 2020
4 Years ago
benitoh questions
Sun, Mar 21, 21, 00:00, 3 Years ago
Mon, May 13, 19, 00:00, 5 Years ago
;