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 8754489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:37:57+00:00 2026-06-13T13:37:57+00:00

Why does calling 152..toString(2) return a binary string value of "10011000" , when a

  • 0

 

Why does calling 152..toString(2) return a binary string value of "10011000", when a call to 152.toString(2) throws the following exception?

          "SyntaxError: identifier starts immediately after numeric literal"


It seems to me that it’s intuitive to want to use the latter call to toString(), as it looks & feels correct. The first example just seems plain odd to me.

Does anyone know why JavaScript was designed to behave like this?

  • 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-06-13T13:37:59+00:00Added an answer on June 13, 2026 at 1:37 pm

    A . after a number might seem ambiguous. Is it a decimal or an object member operator?

    However, the interpreter decides that it’s a decimal, so you’re missing the member operator.

    It sees it as this:

    (10.)toString();  // invalid syntax
    

    When you include the second ., you have a decimal followed by the member operator.

    (10.).toString();
    

    @pedants and downvoters

    The . character presents an ambiguity. It can be understood to be the member operator, or a decimal, depending on its placement. If there was no ambiguity, there would be no question to ask.

    The specification’s interpretation of the . character in that particular position is that it will be a decimal. This is defined by the numeric literal syntax of ECMAScript.

    Just because the specification resolves the ambiguity for the JS interpreter, doesn’t mean that the ambiguity of the . character doesn’t exist at all.

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

Sidebar

Related Questions

Are jQuery events blocking? For example does calling the following method return immediately? $(body).trigger(myEventName,
Java 6 API question. Does calling LockSupport.unpark(thread) have a happens-before relationship to the return
I am calling NetUserAdd and it is returning 24 for every call. Does anyone
Why does calling my JavaScript function throw an error when I call it like
Just out of curiosity, why does calling IEnumerable.ToList() on an existing List not return
Does calling SyncFolderItems in a loop (until MoreChangesAvailable is false) return items that have
Does calling a destructor of an boost::lock object explicitly have any consequence at all?
If something is visible, does calling movieclipname.visible = true; each frame do anything performance
Is this a bad idea? Does calling a generic private constructor within a public
The browser does this by calling public void emulateShiftHeld() method on the WebView which

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.