<! DOCTYPE html>//for-in are typically used to traverse an object, or to iterate over an array //var obj = { //Name: "Xiaoming", //Age:8 // }; //For (var k in obj) { ////Use the dot operator here, you cannot get to the corresponding value: ////. Role: Access the properties of an object //Console.log ("key is:" + K + ", value is:" + obj[k]); // } //var arr = [1, 3, 5]; //For (var k in arr) { //Console.log ("key is:" + K + ", value is:" + arr[k]); // } //In operator function: //is to determine whether the property exists in the object, and if so, the return value is: True //If it does not exist: false //syntax: Properties in Object //var obj = { //name1: "Jack", //Age:9, //abc:undefined // }; //for Name, Note: Window has the Name property //Console.log ("name1" in obj);//True //Console.log ("age" in obj); //Console.log ("age123" in obj); //if the member exists in the object or is a member of the prototype, the result returned is true //Console.log ("toString" in obj); //Console.log (obj.tostring ()); //Console.log ("abc" in obj); //The in operator determines the array //for arrays, the index number is the attribute vararr = [1]; //Console.log ("1" in arr);//False //Console.log ("0" in arr);//True //console.log (0 in arr);//True //to access the members of an array: //You can use an array index or you can use a stringConsole.log (arr[0]); Console.log (arr["0"]); </script></body>JavaScript in usage Introduction