Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Undefined Vs Null in Java Script

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 120
    Comment on it

    Undefined Vs Null in JavaScript

    Undefined means a variable has been declared but not assign any value. While null is an assignment value. It can be assigned to a variable that represent no value.

    For Example:

    var x;
    
    alert(typeof(x));
    
    var y = null;
    
    alert(typeof(y));
    

    output of above example:

    undefined

    object

    From above example, it is very clear that undefined and null are two distinct types:

    By default Unassigned variables is undefined which is automatically initialized by JavaScript. JavaScript never sets a value to null but this can be done by programmatically.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: