1

I have a JavaScript array:

var myArray = [linkA, linkB, linkC, linkD, linkE, linkF, linkG, linkH, linkI, linkJ];

I know the value of the index from other calculations. So what I want to do is find an item in the array based on the known index value. Here's what I've tried so far but it's not working:

var myIndex = 1; //Set from other calculations

var myIndexValue = myArray.find(myIndex);
1
  • 4
    Not sure what you mean by "Value Pair" in the title, but to get an item with an index, it's just myArray[myIndex] Commented Nov 27, 2018 at 20:15

1 Answer 1

1

You just need to access it like so:

myArray[myIndex]
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.