isNaN(x) If x is the special non-numeric value NaN (or can be converted to such a value), The returned value is true. If x is any other value, returns false.
i is index
If the first loop
a[i] is 't'
b[a[i]] is b['t'] and the access subscript is 't' The object
b[a[i]] that is not a number is always NaN
isNaN(b[a[i]] ) is true because b has no subscript and the object b with t is now empty
! isNaN(b[a[i]] ) is false
!isNaN(b[a[i]] )||(b[a[i]]=1); or operator||If one is true, it is true The expression on the left is false, so then executing the expression on the right can be regarded as the abbreviation of the conditional statement if(isNaN(b[a[i]] )){b[a[i]]=1}
(b[a [i]]=1); If the left one is not true, set the subscript of b b['t']=1;
Loop again and if t is encountered, t will be executed successfully. If not, continue to set the subscript
This example does not take into account spaces, special characters, etc.