I have meet some problem , i want to return native string symbol iterator when string not include “!”
Object.defineProperty(
String.prototype,Symbol.iterator,
{
writable: true, configurable: true, enumerable: false,
value: function iterator(){
var i, inc, done = false,str=this
return {
next() {
if((str).includes("!")){
do custom iterator
}else {
return native string iterator
}
} };
} }
);
Any pepole can help , thanks!