G'day all, I have an Array composed of various numbers. I want to select one of those entries then add or subtract from that entry and use the result to refer to a second Array.
The problem I am having is that javascript keeps assuming I am dealing with string values. How can I get round this ?
specifically if starSquare is 45 (see code below) and startSquaresList[startSquare] is 77, I want startSquaresList[startSquare] + 1 to be 78, but it keeps coming out 771 !
Here is the code I have:
- startSquare is a number generated by Math function.
The problem I am having is that javascript keeps assuming I am dealing with string values. How can I get round this ?
specifically if starSquare is 45 (see code below) and startSquaresList[startSquare] is 77, I want startSquaresList[startSquare] + 1 to be 78, but it keeps coming out 771 !
Here is the code I have:
- startSquare is a number generated by Math function.
Code:
document.getElementById("coords").value = "startSquare =" + startSquare + " - " + startSquaresList[startSquare] + " - " + startSquaresList[startSquare] + 1;