Using for in loop complex data types (object and array) in ES6

For in loop objects
For in looping objects, actually looping properties

   obj = {
            name: "No name",
            sex: "man",
            age: "24"
        }
   for(var i in obj) {
          console.log(i) // name sex age
      }
   for(var i in obj) {
          console.log(obj[i]) // No name man 24
      }

For in loop arrays
For in loops through an array, but it loops through the index

   arr = ["zhangsan","wangwu","lisi"]
   for(var i in arr) {
          console.log(i) //0 1 2
      }
   for(var i in arr) {
          console.log(arr[i]) //zahngsan wangwu lisi
      }

Read More: