-2

I'm struggling to get the "index value" of the index SCORE in this code. The array is made up of 6 elements, the first element being the "index 1", the second one the "index 2" and so on...

How do I get the corresponding INDEX VALUE in INT TYPE in this code?

I understand this is quite a dumb question, but I'd really appreciate your help

Hamish
  • 74,809
  • 18
  • 177
  • 265

1 Answers1

0

You can use the index(of) method of arrays like this:

let arr = [1,2,3]
arr.index(of: 1)
Dávid Pásztor
  • 45,571
  • 9
  • 73
  • 100