Created
October 8, 2025 17:58
-
-
Save jaySmilet/feb04a60ae445b25f383423db4e0f519 to your computer and use it in GitHub Desktop.
Call Apply Bind Alternative
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Using spread instead of apply | |
| let args = [1, 2, 3]; | |
| someFunc(...args); // No need for apply! | |
| // Arrow functions for keeping 'this' | |
| const buttons = document.querySelectorAll('.btn'); | |
| buttons.forEach(btn => btn.addEventListener('click', () => handleClick())); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment