Skip to content

Conversation

@Nishant9771
Copy link

The issue in this code is that when setTimeout is called, the context (this) inside the bark method is lost. This happens because setTimeout executes the function in the global context, not the context of the ralph object.

To overcome this issues, i use the bind method to ensure that this inside the bark method refers to the ralph object.

The corrected code for 1.js is updated check once for better code.

The issue in this code is that when setTimeout is called, the context (this) inside the bark method is lost. This happens because setTimeout executes the function in the global context, not the context of the ralph object.

To overcome this issues, i use the bind method to ensure that this inside the bark method refers to the ralph object. 

The corrected code for 1.js is updated check once for better code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant