- 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!
Reply to: isError = isError || false;
Collapse
You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:
- You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
- You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
- If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.
Logging in...
Previously on "isError = isError || false;"
Collapse
-
If you think JS and the browser DOM can be a pain now, just have a look at these JavaScript FAQs from 1996 - and that's when we only had one browser (Netscape Navigator 2) to worry about!
-
I seem to always get dumped on javascript as has happened to me again. I don't even bother telling PMs that java and javascript are different now
Anyway, I just can't get my head around the stuff. Just seems to be layers of hacks to do stuff that can usually be done quite simply server side.
I agree that jquery/ajax stuff can be useful at times there just seems to be too much of it very badly written.
Leave a comment:
-
Yes, but really you'd want
while(truthiness)
{
doUpdation();
}
// falsiness now applies
Crazy language. I never thought initialising variables before you used them was much of a problem.
Leave a comment:
-
In Javascript you have something called truthiness and falsieness. It means that non-boolean variables can be either truthy or falsy which means they evaluate to true or false when used in a boolean situation.Originally posted by VectraMan View PostDoes that not only work if isError is a boolean? I.e. the || operator is a boolean operator, it can only be true or false, and I'll take your word for it that undefined || false == false. But it wouldn't work if isError was 5.7.
I would have done isError == undefined ? false : isError;
Which says what it means, rather than some wierd script kiddyish hackery.
eg. Off the top of my head, the following are falsy:
false
0
null
undefined
empty string
Everything else is truthy. So you could use:
if(response) {
do stuff
}
and assuming response is not a falsy value it should 'do stuff'.
It's an odd language but it makes sense once you get used to it.
Sort of
Leave a comment:
-
Does that not only work if isError is a boolean? I.e. the || operator is a boolean operator, it can only be true or false, and I'll take your word for it that undefined || false == false. But it wouldn't work if isError was 5.7.Originally posted by Bunk View PostIt means - if isError exists then keep it the same, otherwise set it to false.
I would have done isError == undefined ? false : isError;
Which says what it means, rather than some wierd script kiddyish hackery.
Leave a comment:
-
Ah, cheers, see it now.
Christ, can they not just have types like normal languages.
Leave a comment:
-
It means - if isError exists then keep it the same, otherwise set it to false.Originally posted by minestrone View PostFound the above in a line of javascript which I am not that great on.
Is there any reason to do this? Am I missing something? Some js trick?
Or can we just put this down to offshore devs?
You see it a lot when you don't know if a variable or object has been created yet but you need it to exist so you might use:
var CUK = CUK || {};
So now you know that CUK definitely exists.Last edited by Bunk; 13 March 2013, 10:47.
Leave a comment:
-
isError = isError || false;
Found the above in a line of javascript which I am not that great on.
Is there any reason to do this? Am I missing something? Some js trick?
Or can we just put this down to offshore devs?Tags: None
- 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
Contractor Services
CUK News
- Dividends in 2026/27: an expert’s explainer for contractors Today 07:20
- Contracting Awards 2026 opens for entries — with new AI category Yesterday 07:26
- Contractors, beware these four traps in the UK’s Statutory Residence Test Mar 11 00:23
- ‘Stable’ IT contractor demand moved near growth in February 2026 Mar 10 06:49
- What is a tax-efficient salary for 2026/27 as a limited company director? Mar 9 06:23
- Why the McCann Review is the latest failure of the Loan Charge scandal Mar 6 06:53
- What did Spring Statement 2026 say about mortgages? Mar 5 07:29
- Rachel Reeves overlooks contractors in ‘thin’ Spring Statement 2026 Mar 4 07:15
- Spring Statement 2026: chancellor’s full speech Mar 3 21:03
- Unlike today’s ‘boring’ Spring Statement 2026, Make Work Pay is transformative for contractors Mar 3 07:45


Leave a comment: