Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Stackorigin – The Community of Question and Answers

Stackorigin – The Community of Question and Answers Logo Stackorigin – The Community of Question and Answers Logo
Search
Ask A Question

Mobile menu

Close
Ask a Question
Home/ Questions/Q 205
Next
In Process
raju
  • 0
raju
Asked: September 5, 20202020-09-05T20:31:46+00:00 2020-09-05T20:31:46+00:00In: Programming

What is the difference between null and undefined in JavaScript?

  • 0

What is the difference between null and undefined in JavaScript?

javascriptnullundefined
  • 3 3 Answers
  • 275 Views
  • 0 Followers
  • 0
Share
  • Facebook

    Related Questions

    • Django DateTime form widget in forms
    • CharFields must define a 'max_length' attribute in Django
    • Difference between auto_now and auto_now_add-django
    • How to Check Django Database Connection
    • What kind of database's support Django
    • Django TemplateSyntaxError - 'staticfiles' is not a registered tag library
    • difference between 'content' and 'text'
    • object has no attribute 'acquire'
    • Why do we need daemon threads?
    • DeprecationWarning: getName() is deprecated, get the name attribute instead

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Forgot Password?

    Need An Account, Sign Up Here

    3 Answers

    • Voted
    • Oldest
    • Recent
    1. ashok
      2020-09-05T20:55:41+00:00Added an answer on September 5, 2020 at 8:55 pm
      This answer was edited.

      Null and Undefined are both data types in JavaScript. Undefined is a variable that has been declared but not assigned a value. Null as an assignment value. … However, when you assign null to a variable, you are declaring that this value is explicitly empty.

      Example:

      <html>
         <body>
            <input type="text" id="Stackorigin">
            <script>
               var a = null; //NUll
               console.log( a );   //output: null
               console.log( typeof(a) );   //output: object
               var a;                      //undefined
               console.log(a); //undefined
               console.log(typeof(a))
            </script>
          </body>
      </html>

       

       

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    2. carlosridg
      2021-03-09T05:12:49+00:00Added an answer on March 9, 2021 at 5:12 am

      The value ‘undefined’ denotes that a variable has been declared, but hasn’t been assigned any value. On the other hand, Javascript null refers to a non-existent object, which basically means ’empty’ or ‘nothing’. They’re both values usually used to indicate the absence of something . Also, undefined and null are two distinct types: undefined is a type itself (undefined) while null is an object .

       

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
      • 1 Reply
      • sam
        2021-03-09T06:47:28+00:00Replied to answer on March 9, 2021 at 6:47 am

        Nice Tutorial.  Thanks

        • 0
        • Reply
        • Share
          Share
          • Share on Facebook
          • Share on Twitter
          • Share on LinkedIn
          • Share on WhatsApp

    Sidebar

    Ask A Question

    Adv 120x600

    Looking for advertising?

    Consider These Things If You Appreciate What stackorigin Does: Stackorigin is a community where you can ask questions and find answers, for free to everyone. We would appreciate it if you bought us a coffee if you liked what we were doing.

    Buy me a Coffe

    Adv 120x600

    • Random
    • Answers
      • On: March 28, 2022
      • Answers: 0

      How to Start, Stop, and Restart Nginx

      • On: December 26, 2022
      • Answers: 0

      I am getting Mysql not connected error

      • On: October 3, 2020
      • Answer: 1

      What is API?

      • On: August 31, 2021
      • Answer: 1

      download files from s3 given the file path using boto3 ...

      • On: July 23, 2022
      • Answers: 4

      HTML code for INR

    • hari
      hari added an answer date_sortie = forms.DateField(label='Release year',required=False, widget=forms.SelectDateWidget) January 29, 2023 at 4:50 pm
    • hari
      hari added an answer auto_now it updates field each time, while auto_now_add updates on creation… January 29, 2023 at 5:46 am
    • hari
      hari added an answer r.text is the content of the response in Unicode, and r.content is… January 27, 2023 at 4:33 pm
    • sam
      sam added an answer You can't get a new one except after the rest.… January 6, 2023 at 10:37 am
    • sam
      sam added an answer The order is Try, Except, Else should get   January 6, 2023 at 9:28 am

    Adv 120x600

    Trending Categories

    Health
    2028Questions
    , 4Followers
    Programming
    1186Questions
    , 0Followers
    Technology
    216Questions
    , 3Followers
    General Knowledge
    131Questions
    , 0Followers
    Business & Finance
    84Questions
    , 4Followers

    Adv 120×600

    Stats

    • Questions 4k
    • Answers 1k
    • Best Answers 105
    • Users 100

    Users

    niyadas823

    niyadas823

    • 0 Questions
    • 0 Answers
    nirala3

    nirala3

    • 2 Questions
    • 0 Answers
    Perrywalton

    Perrywalton

    • 1 Question
    • 0 Answers
    veeraa

    veeraa

    • 0 Questions
    • 0 Answers
    Stewesmitz

    Stewesmitz

    • 0 Questions
    • 0 Answers

    Adv 120×600

    Explore

    • Recent Questions
    • Most Answered
    • Answers
    • No Answers
    • Most Visited
    • Most Voted
    • Random
    • Polls

    Footer

    Stackorigin - The Community of Question and Answers

    Stackorigin

    Stackorigin is the world’s largest Q&A networking site, Stackorigin community brings you the collaboration of all the various Questions and the related Answers given by the community.

    About

    • About Us
    • Contact Us
    • FAQ
    • Submit Guest Post Article on Technology, Education, Health, Apps, Gadgets, IoT, AI, Business, Digital Marketing and More

    Info

    • Privacy Policy
    • Terms and Conditions
    • Community Guidelines
    • Tags

    Products

    • Tutorials
    • Advertising
    • Categories
    • Corona
    • StackHow

    Follow

    © 2022 Stackorigin. All Rights Reserved.

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.