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 question.

Forgot Password?

Need An Account, Sign Up Here
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
  • 272 Views
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    Related Questions

    • How do I get the current time?
    • How to Install and Use Git on Windows
    • How to Check Git Version
    • git stash and git pull
    • How do I get the number of elements in a list in Python?
    • What is Time and Space Complexity
    • what is array in python
    • OverflowError: Python int too large to convert to C long
    • How do I check if a list is empty?
    • How do I rename both a Git local and remote branch name?

    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

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Forgot Password?

    Need An Account, Sign Up Here

    Sidebar

    Ask A Question

    Stats

    • Questions 1k
    • Answers 1k
    • Best Answers 80
    • Users 81

    Adv 250x250

    Adv 234x60

    • Recent
    • Answers
    • ashok

      How do I get the current time?

      • 2 Answers
    • ashok

      How to Install and Use Git on Windows

      • 1 Answer
    • ashok

      How to Check Git Version

      • 2 Answers
    • arjun

      Which institute is best for a data science course in ...

      • 1 Answer
    • ashok

      git stash and git pull

      • 1 Answer
    • pratap
      pratap added an answer How do I get the current time in Python: The time module… June 29, 2022 at 9:08 am
    • pratap
      pratap added an answer How do I get the current time in Python: Use datetime:… June 29, 2022 at 9:04 am
    • hari
      hari added an answer How to Install and Use Git on Windows Git is… June 29, 2022 at 8:24 am
    • sam
      sam added an answer How to Check Git Version: $ git --version git version… June 29, 2022 at 8:13 am
    • sam
      sam added an answer How to Check Git Version: In a command prompt: $… June 29, 2022 at 8:13 am

    New Members

    Sakshigupta1998

    Sakshigupta1998

    • 0 Questions
    • 0 Answers
    legal heir certificate online apply

    legal heir certificate online apply

    • 0 Questions
    • 0 Answers
    Mutual divorce process india

    Mutual divorce process india

    • 0 Questions
    • 0 Answers
    propertyregistration

    propertyregistration

    • 0 Questions
    • 0 Answers
    Best Gynecologist Hospital in Delhi

    Best Gynecologist Hospital in Delhi

    • 0 Questions
    • 0 Answers

    Adv 234x60

    Trending Categories

    Programming
    825Questions
    , 0Followers
    Technology
    209Questions
    , 3Followers
    General Knowledge
    127Questions
    , 0Followers
    Business & Finance
    81Questions
    , 4Followers
    Employment
    73Questions
    , 3Followers

    Trending Tags

    django (95) git (57) google (29) india (35) mysql (22) oil (54) pandas (23) python (241) usa (25) youtube (24)

    Recent posts

      • On: June 29, 2022

      Bitbucket Cloud recently stopped supporting account passwords for Git authentication

      • On: June 21, 2022

      Best Telegram Movie Channels

      • On: June 17, 2022

      How to Open ICICI Bank Savings Account

      • On: June 15, 2022

      How to Download Your Own Twitch Videos

      • On: June 14, 2022

      How To Permanently Delete Your PSN Account

    Explore Our Blog

    Adv 234x60

    Subscribe

    Explore

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

    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.