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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:09:40+00:00 2026-06-05T04:09:40+00:00

my eval() call is fairly intensive and takes about a second to generate each

  • 0

my eval() call is fairly intensive and takes about a second to generate each solution.

Therefore it takes about a second to generate each paragraph element (which I then append to the dom – document.getElementById('project_euler_solutions').appendChild(p); ).

Therefore I expected each paragraph to appear on the webpage about a second apart. (so after about 40 seconds I would have 40 paragraphs say).

However, when I click the button, Nothing happens for 40 seconds, and then all the solutions appear at once.

How come it waits for all of them to finish before it updates the dom?

I thought each paragraph would appear as soon as it was appended to the dom

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
    <script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.6.2.min.js"></script>
    <script src="/statics/project_euler.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $("button").click(function(){
                for (var i in window) {
                    if (i.slice(0,5) == "solve") {
                        var p = document.createElement('p');
                        p.innerHTML = "running: " + i;
                        document.getElementById('project_euler_solutions').appendChild(p);
                        var p = document.createElement('p');
                        p.innerHTML = "Solution: " + eval(i + "()");
                        document.getElementById('project_euler_solutions').appendChild(p);
                    }
                }
            });
        });
    </script>
</head>

<body>
<div id="project_euler_solutions"><button>Calculate solutions</button></button></div>
</body>
</html>
  • 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-05T04:09:42+00:00Added an answer on June 5, 2026 at 4:09 am

    Javascript runs in the same thread as UI, so you need to give the control back for the DOM to re-draw all the changes.

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

Sidebar

Related Questions

I need to call source on a snow cluster to re-eval some functions. The
procedure MyProc(Eval: Boolean); begin if not Eval then Exit; /* do stuff */ /*
I have a script block, in the div element which is appended after html
How the heck do I call Eval() from codebehind? I know this is a
I'm wondering why when I call: eval(myFunc(1,2,3)) in the Firebug console on a rendered
When I call print from eval : def printList(myList): maxDigits = len(str(len(myList))) Format =
I wish to create a call object from a string. alist() , which does
I was trying to understand this call: deprecate :new_record?, :new? which uses this deprecate
I have an ajax call, which returns datetime. Javascript displays it using client timezone.
I'm making an AJAX call which returns XML data, and this is my 'success:'

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.