JavaScript has string primitives and string objects. (And similarly for numbers and Booleans.) In your first test, you test an object because it new String()creates an object. The second time you test the primitive, because it String(x)simply converts xto a string. The second test is exactly the same as the recordconsole.log('length' in 'test');
in ( ) , -, ; RelationalExpression: RelationalExpression in ShiftExpression:
- (rval) , TypeError.
(, , , , in.)