Undefined Values : Undefined : Number Data Type JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Number Data Type » Undefined »

 

Undefined Values














The variable is 'undefined' if no value has been assigned to it.

Undefined number value is NaN.

Undefined string value is 'undefined'.

Undefined boolean value is false.

The undefined property is a primitive value of the global object.

undefined is returned by variables that have not had values assigned to them.

undefined is also returned by methods if the variable being evaluated is not assigned a value.

The following example tests a Variable to See if It is Undefined.












<html>
    <script language="JavaScript1.3">
    <!--
    var myVariable;

    if(myVariable == undefined){
      document.write("This variable is undefined at the moment");
    }else{
      document.write("This variables value is: " + myVariable);
    }
    -->
    </script>
</html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Number Data Type
» Undefined