What is different between Null and Undefined values in Javascript?

Dung Do Tien Feb 12 2020 524

Can anybody explain help me what is different between Null and Undefined values in Javascript?

Why? and When use it?

Have 1 answer(s) found.
  • B

    Blue Jame Mar 18 2020

    Great question, they are both a data type in javascript ECMA defined.

    1. NUll

     Use when set value for a variable, return of a function

     Ex: var fullname = null;

     

    2. UNDEFINED

    Use when declare but not set any value, function but not return

    Ex: var fullname;

     

Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips

X Close