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

The Archive Base Latest Questions

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

The Confusing discussion In this question , there is a discussion on the concepts

  • 0

The Confusing discussion

In this question, there is a discussion on the concepts of associated array and object in javaScript which I got a bit confused.

In this example code:

var check = {
  pattern : {
    name: /^[a-zA-Z-\s]{1,20}$/,
    email: /^[a-zA-Z0-9._(-)]+@[a-zA-Z0-9.(-)]+\.[a-zA-Z]{1,4}$/,
    pass: /.{6,40}/,
    url:  /^[(-)\w&:\/\.=\?,#+]{1,}$/,
    aml:  /<(.+)_([a-z]){1}>$/
    }
};

Here is the discussion makes me confused:

@steven.yang the outer object is not an associative array in your sample, but that is what is being asked for

@sissonb what do you mean by ‘outer object is not an associative array’? I think associated array is expressed as object in javascript. The difference is in the notation – either through foo.bar or foo[bar]

@steven.yang associated array means key => value. http://en.wikipedia.org/wiki/Associative_array Your inner object has a key of pattern, the object containing this associative array has no key.

My Understanding of Associated Array and Objects in JS

Associated array is defined as key-value pairs which is expressed as the object in JavaScript.

The outer object assigned to check has a key pattern and an value of another object. The inner object has keys of name, email … and corresponding values of regular expression objects.

Could both objects be counted as associative arrays?

  • 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-26T23:58:52+00:00Added an answer on May 26, 2026 at 11:58 pm

    Not really, here’s why:

    var arr = new Array();
    arr["foo"] = 100;
    arr["bar"] = 200;
    console.log(arr.length); // Prints 0.
    

    Adding elements to an associative array should increase its length (IMO).

    It looks and acts (somewhat) like an associative array because of syntactic sugar. What appear to be “array entries”, however, are (just) object properties.

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

Sidebar

Related Questions

This is confusing me, so this question will probably be confusing. I have a
Right this is confusing me quite a bit, i'm not sure if any of
Me and my colleagues got into this discussion early this morning, and our opinions
A bit confusing this one but should make sense. Thanks to all your help
UPDATE: I recently learned from this question that in the entire discussion below, I
I find it confusing that there is an ActiveRecord delete as well as destroy.
I find this pretty confusing. When you want to rotate a view, it's going
The question is confusing, I know, but I just couldn't put it any other
I know this sounds confusing: I have just built some basic prev/next pagination for
This is really confusing me as I'm not doing anything with Strings. This is

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.