Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

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

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7499837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:57:40+00:00 2026-05-29T19:57:40+00:00

I am learning JavaScript and was asked this question, can anyone help? What do

  • 0

I am learning JavaScript and was asked this question, can anyone help? What do the following Javascript statements return and why?

parseInt(“07”);
parseInt(“09”);
parseInt(“010”);

“1” + 2 + 3;

“1” == 1;
“1” === 1;
“1” == true;
“1” === false;

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T19:57:42+00:00Added an answer on May 29, 2026 at 7:57 pm

    Fire up a Development console (like the one in the Chrome Developer Tools or Firebug) and type in the statements, you’ll get the results:

    parseInt('07'); -> 7
    parseInt('09'); -> 0
    parseInt('010'); -> 8
    

    This happens, because parseInt tries to determine the right base of the number contained in the string you’re passing. These numbers are starting with 0, so JavaScript assumes you’re passing “octal” – values. 09 for example doesn’t exist there, so it returns 0.
    You can easily go around this problem by passing a second parameter to parseInt (called the “radix”)

    So, if you want decimal numbers, which will be the case most of the times, you write:

    parseInt('09', 10);
    
    
    "1" + 2 + 3;
    

    will return the string “123”, because JavaScript automatically converts type behind the scenes. Adding numbers to a string will just convert them and concatenate them.

    "1" == 1; "1" === 1; "1" == true; "1" === false;
    

    Here we have the two different operators for comparing. == will compare only value, === will compare value and type. It is considered a good practice to use === most of the time, unless you’re really sure you want to use ==.

    Your first statement will return true, types are converted behind the scenes and the value is the same, your second statement will return false, because the types are not converted and you are comparing String against Number. The third will return true, because “1” is considered as truthy value. The fourth will of course return false, because of this.

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

Sidebar

Related Questions

I am learning javascript and can someone please explain the following code snippet for
I'm learning JavaScript using W3C and I didn't find an answer to this question.
I know this is probably a question that is asked a ton on here
I'm learning javascript and noticed the following two syntaxes achieve the same end goal:
I'm learning javascript. Poked around this excellent site to gather intel. Keep coming across
I'm learning JavaScript, and I can't understand why you'd make methods that aren't 'privileged,'
Sorry if that question is confusing, I'm self-learning javascript. I'm dynamically generating image thumbnails
Im just learning javascript and I'm just wondering why this doesn't work. I've created
Im learning javascript and I just dont understand what this javascript syntax actually means...
I'm only just learning javascript so I imagine this is relatively simple but it's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

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.