/* * Programming Quiz: Make An Iterable Object * * Turn the `james` object into an iterable object. * * Each call to iterator.next should log out an object with the following info: * - key: the key from the `james` object * - value: the value of the key from the `james` object * - done: true or false if there are more keys/values * * For clarification, look at the example console.logs at the bottom of the code. */ const james = { name: 'James', height: `5'10"`, weight: 185 }; // let iterator = james[Symbol.iterator](); // // console.log(iterator.next().value); // 'James' // console.log(iterator.next().value); // `5'10` // console.log(iterator.next().value); // 185
上面这个问题{}不会做,但是[]的会做,如下图
相关分类