Skip to content
CodeWorth
CodeWorth

Code worths when shared

Primary Navigation Menu
Menu
  • BLOG
    • DataBase
    • Programming
    • Mobile
    • Multimedia
    • OS Tips
    • Others
    • Web Development
  • Products
    • Utilities
    • Games
    • JsGenLib
      • PlugIns
      • Core Functions
      • Helper & ShortHands
  • About

Javascript setting variable to undefined

On September 9, 2009
In Web Development
Tagged JavaScript, Web
With 0 Comments

By default when we create a variable without assigning anything, the variable will be undefined

Once we assigned it a value its harder to set it back to undefined as now it has a type and value for it.

We can do in following way using

var a; //a is undefined here
a=5; // a is 5
a = void(0); //a is undefined again here

Here void states that the variable is of no type and 0 assigns to no value.

2009-09-09

Subscribe

Enter your email address to receive notifications about new posts via email.

Join 634 other subscribers

Google

Designed using Chromatic WordPress Theme. Powered by WordPress.