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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:02:37+00:00 2026-05-13T15:02:37+00:00

I am having issues with a couple arrays below and the match method. On

  • 0

I am having issues with a couple arrays below and the match method. On my page I call the Checkout() function and it sets a temporary array equal to the array I’ve been building with different options. It then loops through the temporary array and removes html from one of the elements. The issue is that when I alert the array Remote.Cart.products before the loop it is exactly as it was built, but when I call the function again the exact same alert shows the new updated values even though I am not modifying the Remote.Cart.products array anywhere in the function.

function Checkout() {

tmp = null;
tmp = Remote.Cart.products;

alert( Remote.Cart.products );

    for ( i = 0, li = tmp.length; i < li; i++ ) {

        for ( j = 0, lj = tmp[ i ][1].length; j < lj; j++ ) { 

            tmp[ i ][1][j][1] = tmp[ i ][1][j][1].match(/<a\s+[^>]*href="([^\"]*)"[^>]*>(.*)<\/a>/i)[2];

        }

    }

}

Your help / insight is much appreciated!

  • 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-13T15:02:38+00:00Added an answer on May 13, 2026 at 3:02 pm

    Clint, you have to understand that tmp and Remote.Cart.products are different names for the same array. If you want to clone the array, do:

    var tmp = [];
    for(var i = 0; i < Remote.Cart.products.length; i++)
    {
      tmp[i] = []
      for(var j = 0; j < Remote.Cart.products[i].length; j++)
      {
        tmp[i][j] = [];
        for(var k = 0; k < Remote.Cart.products[i][j].length; k++)
        {
          tmp[i][j][k] = Remote.Cart.products[i][j][k].slice();
        }
      }
    }
    

    EDIT: Nesting corrected thanks to Squeegy

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

Sidebar

Related Questions

October Landing Page I'm having a couple issues on a page I'm developing. In
I am having some issues with a thrown exception. Below is the draw method
For the last couple months i have ben having some issues with my app.config
I am having a couple of issues deciding how best to describe a certain
I'm having a couple of issues which may be related, or may not. I
Having issues referencing $(this) from within a the nested ajax 'success' function... I know
We're trying to setup Jenkins, but we are having a couple issues. We have
Having trouble with a couple of display issues in IE7. Firstly, my large text
I am having issues adding validation methods to a couple of controls in my
I've asked a couple of questions here but am still having issues. I'd appreciate

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.