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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:28:53+00:00 2026-05-26T12:28:53+00:00

Hopefully someone can shed some light on this ‘seemingly’ straight forward issue. I need

  • 0

Hopefully someone can shed some light on this ‘seemingly’ straight forward issue.
I need to compare two arrays to see if they are identical.

var _array1:Array = new Array();
var _array2:Array = new Array();


_array1.push(1,2,3,4,5);

_array2 = _array1.concat();

trace("_array2 "+_array2);
//traces 1,2,3,4,5 so I am assuming the copy took place.


if (_array2 == _array1) {
    trace("the same");
} else {
    trace("different");
}

This test traces ‘different’ even though the arrays are seemingly the same.

Would anyone know where I’m going wrong?

Thanks,

Mark

  • 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-26T12:28:54+00:00Added an answer on May 26, 2026 at 12:28 pm

    Arrays are containers, so checking for equality would be equivalent to checking equality of the elements they contain as well as these elements’ indexes.

    Without going to deep into Object comparisons, your example doesn’t work because these arrays are two different unrelated Objects. You could add or remove elements from one without affecting the other.

    If you want to compare the elements that each Array contains, you may have to come up with a different method, recursively comparing each element , which may not be a simple issue when dealing with complex Objects, but pretty straighforward for integers, Numbers or Strings

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

Sidebar

Related Questions

Hopefully someone can shed some light onto this issue for me. I have a
hopefully someone here can shed some light on my issue :D I've been creating
Hopefully someone can shed a little light on an issue that I'm currently having
I am curious and hopefully someone can shed somelight on this - but why
Hopefully someone can help with this RelativeLayout issue I'm having. If I remove the
This issue is something which has me stumped, so hopefully someone can help. I
Hoepfully someone can shed some light on a problem - I am trying to
This is a weird one, but hopefully someone can give me an idea here.
Ok, this is bit of an obscure question, but hopefully someone can help me
Hopefully, someone can spot the error, what I need to do is to first

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.