代码
提交代码
let str: string = 'Hi' let iterator: IterableIterator<string> = str[Symbol.iterator]() console.log(iterator.next()) // { value: 'H', done: false } console.log(iterator.next()) // { value: 'i', done: false } console.log(iterator.next()) // { value: undefined, done: true }
运行结果