JavaScript
Result
Run
License
class Splitter { constructor(separator) { this.separator = separator; } [Symbol.split](string) { return string.split(this.separator); } } let str = "The grass is always greener on the other side of the fence."; console.log(str.split(new Splitter("on")));
Console
expand_less
License
License
by DevDic
Close