And as an alternative to a whole anonymous class in Java they are a considerable improvement.
- Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
- Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
I think I am going to cry
Collapse
X
-
While you're waiting, read the free novel we sent you. It's a Spanish story about a guy named 'Manual.' -
Suity says.Originally posted by Bunk View PostI also think it's more readable to have the anonymous function which is called when the event is triggered, and inside it you can call any functions you want.
I don't like:
I prefer:Code:element.addEventListener('click', toggleMenu.bind(null, param1, param2), false);
Personal preference, but I won't be changing how I do it anytime soon. Or at least until I see a better argument against it.Code:element.addEventListener('click', function() { toggleMenu(param1, param2); }, false);
Knock first as I might be balancing my chakras.Comment
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers

Comment