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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:51:06+00:00 2026-05-26T05:51:06+00:00

I am used to programming in python and am trying to learn javascript. I

  • 0

I am used to programming in python and am trying to learn javascript. I want the application to work on chrome so dont care to make it cross-browser. I also want to write it without using jquery or another library – since I am just learning javascript.

My general problem is that very often the function calls seem like they are “skipped”. I am using firebug and dont see any errors on the console. So If I have two calls calls right after each other in a function

mydict_user_values = return_dict_of_user_names()
alert("I HAVE USER VALUES " + mydict_user_values.length) 
// This next line gets called sometimes before the previous line so the values in the table filled in by next line are blank even though the dictionary above has the correct length
fill_user_name_values_into_table(mydict_user_values)

I am used to python and dont understand whats going on. Sorry for an abstract question , but there is something fundamental about javascript that I am not getting.

edited: -6 points in one day. I am quite shocked!. I know there are some serious newbie errors in my code: Which I have put here in all its newbie badness.

https://github.com/harijay/gridzilla_web

My Typical functions:

function return_dict_of_user_names()
{
   var my_new_dict 
   var my_user_names = document.getElementsByClassName("my_users");
   for (var i = 0; i <= my_user_names.length ; i++){
      var a_num  = document.getElementById("user_number_" + i).value
      var a_name = document.getElementById("user_name_" + i).value
      my_new_dict[i] = [a_num,a_name]
   }
   return my_new_dict
}

I then have other javascript functions that take these values and populate another part of the same page.

function fill_user_names_into_div(mydict){
   var my_username_dict = mydict;
   //Javascript code to fill in the values by lines like
   my_fillable_elements = document.getElementsByClassName("user_table_fancy_entry")
   for (var i = 0 ; i <= my_fillable_elements.length ; i++){
      document.getElementById("usertable_user_number_" + i).value = my_username_dict[1][1]
   }
  • 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-26T05:51:06+00:00Added an answer on May 26, 2026 at 5:51 am

    Javascript statements are executed synchronously. I think you have some javascript errors that is probably halting execution in some places. You should be looking in an javascript error console or a debug console to see where you have javascript errors. For example, in this function:

    function return_dict_of_user_names()
    {
       var my_new_dict 
       var my_user_names = document.getElementsByClassName("my_users");
       for (var i = 0; i <= my_user_names.length ; i++){
          var a_num  = document.getElementById("user_number_" + i).value
          var a_name = document.getElementById("user_name_" + i).value
          my_new_dict[i] = [a_num,a_name]
       }
       return my_new_dict
    }
    

    You have to initialize my_new_dict to an array before using it as such like this:

    function return_dict_of_user_names()
    {
       var my_new_dict = [];   // initialize to empty array
       var my_user_names = document.getElementsByClassName("my_users");
       for (var i = 0; i < my_user_names.length ; i++) {
          var temp = [];
          temp.push(document.getElementById("user_number_" + i).value);
          temp.push(document.getElementById("user_name_" + i).value);
          my_new_dict.push(temp);
       }
       return my_new_dict;
    }
    

    Also, javascript statements should end with a semicolon and I’d recommend using .push() to add an item onto the end of an array.

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

Sidebar

Related Questions

I want to know the programming language used by Boxee.tv guys to build their
At work we used to program our Python in a pretty standard OO way.
In other programming languages (Python, Ruby, Scheme), I'm used to doing things like $foo
I have never used Python before, most of my programming has been in MATLAB
Every programming language I know (Perl, Javascript, PHP, Python, ASP, ActionScript, Commodore Basic) uses
I've got a weird problem with python programming. I used the statement'writelines()' to write
Recently I decided to expand my programming horizons and learn the python programming language.
Which widely used programming languages were designed ground-up with Unicode support? A lot of
I'm not very used to programming with flags, but I think I just found
I've seen it used in programming (specifically in the C++ domain) and have no

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.