This article mainly introduces the usage of the in operator in javascript. The example analyzes the usage skills of the in operator, which is of great practical value, for more information about how to use the in operator in javascript, see the example in this article. Share it with you for your reference. The specific analysis is as follows:
The in operator wants its left operand to be a string or can be converted to a string, and its right operand to be an object. If the right object has a property name named the left operation value, then the expression returns true:
Var point = {x: 1, y: 1 }; "x" in point // true "z" in point // false "toString" in point // truevar ary = [1, 2, 3]; "0" in ary; // true, ary contains index 0 ("0" is switched to 0); 1 in ary; // true, ary contains Index 13 in ary; // false
I hope this article will help you design javascript programs.