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

  • SEARCH
  • Home
  • 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 6888677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:03:25+00:00 2026-05-27T06:03:25+00:00

Exhibit A: var pt = [0,0,0,0,0,0]; console.log(pt[0], pt); sometimes the log will spit out

  • 0

Exhibit A:

var pt = [0,0,0,0,0,0];
console.log(pt[0], pt);

sometimes the log will spit out 0 [Infinity, Infinity, Infinity, Infinity, Infinity, Infinity], but only when you do a SIX zeroes array for pt. If you do five zeroes then you get an array of five zeroes as expected. The big clencher is how pt[0] can occassionally be 0 and Infinity a the same time confusion

Steps to re-create the problem:

  • Download the Development branch of Flanvas
  • Make sure you place the folder in web-server directory (otherwise you will encounter cross-domain issues)
  • Run the page examples/loader-svg.js
  • Look at the console to see the mix-up I’m referring to.

*Notes

  • The console log in question (Exhibit A) located in src/flanvas.js on line 2958
  • The framework has recently undergone a "shload" of updates and you’ll notice not everything works — I am aware.
  • I’m testing on Mac OSX 10.6.8 and Chrome 15.0.874.121

If there are any problems with my instructions, please post back and I’ll get to them ASAP. Thanks.

** Clarification of the question **

If I run console.log(pt[0], pt); then I expect that the first value from the array pt and pt[0] will be identical. That’s not the case in my Exhibit A. Why not?

  • 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-27T06:03:26+00:00Added an answer on May 27, 2026 at 6:03 am

    console.log() isn’t necessarily synchronous, so whatever code is causing the values to be Infinity is likely happening later.

    If you want to see the Array values in their current state, you need to be sure to capture its current value somehow.

    One way is to abuse JSON for this purpose.

    var pt = [0,0,0,0,0,0];
    console.log(pt[0], JSON.stringify( pt ));
    

    Or since it’s an Array of primitives, you could slice it.

    var pt = [0,0,0,0,0,0];
    console.log(pt[0], pt.slice());
    

    To find the actual issue, you’re going to have to follow pt along and see who’s misusing it.


    demonstration

    Here’s a demo for illustrative purposes.

    http://jsfiddle.net/J7tbB/

    var later = Date.now() + 1000;
    
    var arr = [0,0,0,0,0];
    
    console.log( arr );
    
    while( Date.now() < later ) {
        var len = arr.length;
        while( len-- ) arr[len]++;
    }
    

    Note that this freezes your browser for 1000ms.

    As you can see, it creates an Array with 5 members initialized at 0, then immediately passes the Array to console.log.

    Right after that you have a while loop that will run for 1000ms, incrementing each member once for each iteration.

    If the console.log was synchronous, you’d get your zeros. Instead you’ll likely get something like:

    [2811349, 2811349, 2811349, 2811349, 2811349]
    

    Now if we change it so that it logs a .slice() of the Array, you’ll see that you get your expected values.

    http://jsfiddle.net/J7tbB/1/

    console.log( arr.slice() );
    
    // ...
    
    [0, 0, 0, 0, 0]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Every once in a while, but especially prevalent on Facebook, Opera Mini will exhibit
Why do most languages seem to only exhibit fairly basic control structures from a
I wanted to create a view, that will exhibit the same property as the
These two methods exhibit repetition: public static Expression<Func<Foo, FooEditDto>> EditDtoSelector() { return f =>
I'm seeing OraclePreparedStatement executeQuery() exhibit serialization. That is, I have two queries that I
My installation of XCode 3.2 has begun to exhibit some strange behaviour. When I
I thought that by default my Regex would exhibit the greedy behavior that I
I'm working on a WPF application that sometimes exhibits odd problems and appears to
'm using to Exhibit to, pretty simply, display some data on historical events and
I am interested in finding the numbers that exhibit the property of having the

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.