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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:45:28+00:00 2026-05-16T10:45:28+00:00

var array1 = {}; array1[‘one’] = new Array(); array1[‘one’][‘data’] = ‘some text’; array1[‘one’][‘two’] =

  • 0
var array1 = {};

array1['one'] = new Array();
array1['one']['data'] = 'some text';
array1['one']['two'] = new Array();
array1['one']['two']['three'] = new Array();
array1['one']['two']['three']['data'] = 'some other text';

$.each(array1, function(key1, value1){
    $.each(value1['two']['three'], function(key1, value1){
        document.write('test');
    }
});

everything works, except it doesnt get to the document.write.
Anyone an idea why?

  • 1 1 Answer
  • 1 View
  • 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-16T10:45:29+00:00Added an answer on May 16, 2026 at 10:45 am

    Note that the Array() replacement is key here with the missing ‘)’

    var array1 = {};
    
    array1['one'] = new Object();
    array1['one']['data'] = 'some text';
    array1['one']['two'] = new Object();
    array1['one']['two']['three'] = new Object();
    array1['one']['two']['three']['data'] = 'some other text';
    
    $.each(array1, function(key1, value1) {
        $.each(value1['two']['three'], function(key1, value1) {
            document.write('test');
        });
    });
    

    and Another way to write the same thing:(small tweek on the write to reference your object)

    var array1 = {};
    
    array1.one = new Object();
    array1.one.data = 'some text';
    array1.one.two = new Object();
    array1.one.two.three = new Object();
    array1.one.two.three.data = 'some other text';
    
    
    $.each(array1, function(key1, value1) {
        $.each(value1['two']['three'], function(key1, value1) {
            document.write('test' + array1.one.data);
        });
    });
    

    And finally, with the deprecated new Object() replacement:

    var array1 = {};
    
    array1['one'] = {}
    array1['one']['data'] = 'some text';
    array1['one']['two'] = {};
    array1['one']['two']['three'] = {};
    array1['one']['two']['three']['data'] = 'some other text';
    
    $.each(array1, function(key1, value1) {
        $.each(value1['two']['three'], function(key1, value1) {
            document.write('test');
        });
    });
    

    EDIT: some fun with your array, and why you MIGHT have the strings in the object declaration as you have it:

    var array1 = {}; 
    var fun="four"; 
    array1.one = {}; 
    array1.one.data = 'some text'; 
    array1.one.two = {}; 
    array1.one.two.three = {}; 
    array1.one.two.three.data = 'some other text'; 
    array1.one.two[fun] = {};
    array1.one.two[fun].data=' howdy';
    
    $.each(array1, function(key1, value1) { 
        $.each(value1.two.three, function(key1, value1) { 
            document.write('test'+array1.one.two[fun].data+ ":"+key1+":"+value1); 
        }); 
    });
    

    the output the the last is: “test howdy:data:some other text”

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

Sidebar

Related Questions

i have a three arrays in javascript var array1 = new Array (1,2,3,4,5); var
var array1:Array = new Array(); var array2:Array = new Array(); var obj1:Object = new
var array1:Array = new Array(); var array2:Array = new Array(); var obj1:Object = new
I have an array in JavaScript as follows: <script type="text/javascript"> var array1 = Array(0,1,2,3,4,5);
<script language=javascript type=text/javascript> function TextDefine(val){ var i= 0; var array1 = val.value.split(\n); for (
I have an array below, var array = { Id:[1,2,3], Name:[one,two,five], row:[8,9,7] } but
Let's say I have these two arrays: var array1 = new[] {"A", "B", "C"};
function split(str) { var array = str.split(';'); var test[][] = new Array(); for(var i
How to rewrite the code using jQuery? <script type=text/javascript> window.onload = function(){ var array
I have a JSON format of var array1 = new Array; var array2 =

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.