0
How can I make this code true??
9 Answers
+ 5
Like this:
https://code.sololearn.com/WmJQ6fNOU9u0
+ 6
l1 is the list of characters to check against str.value[i]. indexOf returns -1 on failure to find the character or the index within the list so 0 or greater.
+ 4
There are definitely things that try to convince you of that. However, eventually it makes sense and, when those types of new concepts attempt to confuse you, you go: oh..., yeah that makes sense. I just had one of those moments in Kotlin generics. About 5 minutes of what? Before, right! dawned. Just forge ahead you'll get there.
+ 4
it isn't legal to test a char against a list. If JS had an in operation like other languages, we could do: if(str.value[i] in l1). However, JS's in only verifies properties of the object.
+ 1
variable names cannot be numbers, also you can't assign multiple values like you tried to do with multiple "=" symbols. rather i suggest making each variable an array of characters and checking if which one the current character belongs to
+ 1
Right on right on
0
Every time that I read programming it gets harder😥
0
and why did you write if(l1.indexOf(str.value[i]) >= 0)
I don't underestand that
0
Can we write another if.. here
e.g:if(str.value[i] == l1){score++}



