0
How to turn a string to a number?
For example, when using a prompt to enter a number, how to turn the result to an integer to get an element of an array? Edit: I messed up a little. I also mean to make it accept numerical operators like sum it 1 and then search the element.
1 Antwort
0
In js, there is no need to convert, for example, "1" to 1 in order to select an element of the array; conversion takes place automatically.
a = 1;
arr [a];
or
a = "1";
arr [a], no difference