Must be an array type but resolved to string

前端 未结 7 963
梦谈多话
梦谈多话 2021-01-16 07:01

I am getting the \"Must be an array type but it resolved to string\" error in my code. It also says that i (in the code below) cannot be resolved to a variable which I don\'

7条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-16 07:28

    Your problem is with syntax dna[i], dna is a string and you access it as it would be an array by []. Use dna.charAt(i); instead.

提交回复
热议问题