Changing the join funcion

Array.prototype.joinOriginal = Array.prototype.join

Array.prototype.join = function() {
console.log(‘join called on’, this)
return this.joinOriginal(arguments)
}
let l=[123,234,345,445]
l.join(’;’)

when I am doing the above thing at console I am getting
an infinite output ex:

join called on 1[object Arguments]2[object Arguments]3[object Arguments]4

join called on 1[object Arguments]2[object Arguments]3[object Arguments]4

join called on 1[object Arguments]2[object Arguments]3[object Arguments]4

like this plz resolve it sir

@aggarwalanshul01 problem with your code is that, you have to expand the arguments using triple dot syntax, try the following code and it will work
return this.joinOriginal(...arguments)

sir its giving same problem after expanding using triple dot syntax

@aggarwalanshul01 here is the working code

Array.prototype.joinOriginal = Array.prototype.join

Array.prototype.join = function() {
    console.log('join called on', this)
    return this.joinOriginal(...arguments)
}
let l=[123,234,345,445]
l.join(';')

try this after clearing of the history from the console

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.