Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Cls {
- constructor() {
- }
- replacer () {
- console.log(this)
- return '6'
- }
- func(){
- console.log(JSON.stringify(this))
- var r = '123456'.replace(/1/g, this.replacer)
- console.log(r)
- }
- }
- var ex = new Cls()
- ex.replacer()
- ex.func()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement