IndexOf
Back to a
variable. Also this time there is a lot of text:
let a = 0;
a = a - "Strings can help to increment our variable with this number:".indexOf('1') // a = 1
Explanation
This one doesn’t have tricky JS code. We just try to find index of 1
in string, but it will return -1
because this substring isn’t present. After that simple math helps us to increment variable.