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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:39:13+00:00 2026-05-23T07:39:13+00:00

Here’s what I’m looking to do.. var dual = new Array; dual=[voter,thisID]; var matrix

  • 0

Here’s what I’m looking to do..

var dual = new Array; 
dual=[voter,thisID];
var matrix = new Array;
matrix[dual]=voteint; //this works..

but I’d like to easily access values by either or both key (array) element:

matrix[*,thisID])=answer; 

except wildcards don’t exist in this way, right?

one could do…

matrix[voter+'.'+thisID]=voteint;

and do regex matching around the ‘.’ but is there a better/easier/faster way?

  • 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-23T07:39:13+00:00Added an answer on May 23, 2026 at 7:39 am
    > var dual = new Array; 
    > dual=[voter,thisID];
    

    The second assignment replaces the array originally assigned to dual, making the first assignment useless. It can be written:

    var dual = [voter, thisID];
    

    but only if voter and dual have been declared or created as variables earlier.

    > var matrix = new Array;
    > matrix[dual]=voteint; //this works..
    

    As above, the first assignment to matrix is redundant.

    It “works” by assigning a property to matrix that is dual.toString(), so if you’d written:

    var voter = 'foo';
    var thisID = 'baz';
    var dual = [foo, baz];
    

    then

    matrix[dual] = voteint;
    

    is equivalent to:

    matrix['foo,baz'] = voteing;
    

    if voteint has been assigned a value earlier.

    but I’d like to easily access values
    by either or both key (array) element:

    > matrix[*,thisID])=answer;
    

    except wildcards don’t exist in this way,
    right?

    Not in that context, no.

    one could do…

    matrix[voter+’.’+thisID]=voteint;

    If the . was replaced by a comma, yes.

    and
    do regex matching around the ‘.’ but
    is there a better/easier/faster way?

    It is considered bad practice to use an Array where an Object is indicated, so better to use an Object here.

    Your only reasonable option is to iterate over the object’s properties using for..in to test each property name to find the one you want. Note that you should also include a hasOwnProperty test to exclude inherited enumerable properties.

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

Sidebar

Related Questions

Here's a coding problem for those that like this kind of thing. Let's see
Here is an example. foreach (var doc in documents) { var processor = this.factory.Create();
Here my code: $(document).ready(function() { $('#mid_select').live('click', function(e){ $('#middle').load( $(this).attr('href') + ' #middle'); var page
Here's what I'm trying to accomplish with this program: a recursive method that checks
Here is the css: #content ul { font-size: 12px; } I am trying this:
Here's a query that works fine: SELECT rowid as msg_rowid, a, b, c FROM
Here is what I am trying to achieve in PHP: I have this string:
Here is my question. I am having this simple menu. <div id=menu> <ul> <li>
Here i need to add textbox to messagebox.but the message box dose not adding
Here an example of my code. $(#slideshow img).on(click, function (e) { $(.fullimage).hide(); var next

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.