Categories

# what is the result of

## Logical operators

There are three logical operators in JavaScript: || (OR), && (AND), ! (NOT).

Although they are called “logical”, they can be applied to values of any type, not only boolean. Their result can also be of any type.

Let’s see the details.

The “OR” operator is represented with two vertical line symbols:

In classical programming, the logical OR is meant to manipulate boolean values only. If any of its arguments are true , it returns true , otherwise it returns false .

In JavaScript, the operator is a little bit trickier and more powerful. But first, let’s see what happens with boolean values.

There are four possible logical combinations:

As we can see, the result is always true except for the case when both operands are false .

If an operand is not a boolean, it’s converted to a boolean for the evaluation.

For instance, the number 1 is treated as true , the number 0 as false :

Most of the time, OR || is used in an if statement to test if any of the given conditions is true .

We can pass more conditions:

### OR “||” finds the first truthy value

The logic described above is somewhat classical. Now, let’s bring in the “extra” features of JavaScript.

The extended algorithm works as follows.

Given multiple OR’ed values:

The OR || operator does the following:

• Evaluates operands from left to right.
• For each operand, converts it to boolean. If the result is true , stops and returns the original value of that operand.
• If all operands have been evaluated (i.e. all were false ), returns the last operand.

A value is returned in its original form, without the conversion.

In other words, a chain of OR || returns the first truthy value or the last one if no truthy value is found.

This leads to some interesting usage compared to a “pure, classical, boolean-only OR”.

Getting the first truthy value from a list of variables or expressions.

For instance, we have firstName , lastName and nickName variables, all optional (i.e. can be undefined or have falsy values).

Let’s use OR || to choose the one that has the data and show it (or “Anonymous” if nothing set):

If all variables were falsy, “Anonymous” would show up.

Short-circuit evaluation.

Another feature of OR || operator is the so-called “short-circuit” evaluation.

It means that || processes its arguments until the first truthy value is reached, and then the value is returned immediately, without even touching the other argument.

That importance of this feature becomes obvious if an operand isn’t just a value, but an expression with a side effect, such as a variable assignment or a function call.

In the example below, only the second message is printed:

In the first line, the OR || operator stops the evaluation immediately upon seeing true , so the alert isn’t run.

Sometimes, people use this feature to execute commands only if the condition on the left part is falsy.

The AND operator is represented with two ampersands && :

In classical programming, AND returns true if both operands are truthy and false otherwise:

Logical operators There are three logical operators in JavaScript: || (OR), && (AND), ! (NOT). Although they are called “logical”, they can be applied to values of any type, not only boolean.

This information is about the swab test to check if you have coronavirus (COVID-19).

You’ll get a text or email with your result when it’s ready. If you use the NHS COVID-19 app, you may also get your result in the app.

Most people get their result the next day, but it may take up to 3 days.

If you do not get your result by day 6, call the coronavirus testing contact centre on 119 (England, Wales and Northern Ireland) or 0300 303 2713 (Scotland). The contact centre is open from 7am to 11pm.

There are 3 types of result you can get:

• negative
• positive
• unclear, void, borderline or inconclusive

#### Stay at home

If you had a test because you had symptoms, you and anyone you live with must stay at home until you get your result.

Anyone in your support bubble must also stay at home until you get your result if you’ve been in close contact with them since your symptoms started or during the 48 hours before they started.

A support bubble is where someone who lives alone (or just with their children) can meet people from 1 other household.

### Negative test result

A negative result means the test did not find coronavirus.

You do not need to self-isolate if your test is negative, as long as:

• everyone you live with who has symptoms tests negative
• everyone in your support bubble who has symptoms tests negative
• you were not told to self-isolate for 14 days by NHS Test and Trace – see what to do if you’ve been told to self-isolate
• you have not travelled to the UK from a place with a high coronavirus risk – see how to self-isolate when you travel to the UK on GOV.UK
• you feel well – if you feel unwell, stay at home until you’re feeling better

Contact your GP if your symptoms get worse or do not go away.

If you have diarrhoea or you’re being sick, stay at home until 48 hours after they’ve stopped.

If you’re a health or care worker, check with your employer before going back to work.

### Positive test result

A positive result means you had coronavirus when the test was done.

If your test result is positive, you must self-isolate immediately.

• If you had a test because you had symptoms, self-isolate for at least 10 days from when your symptoms started.
• If you had a test but have not had symptoms, self-isolate for 10 days from when you had the test.

For more information about what you, anyone you live with and anyone in your support bubble need to do, see how long to self-isolate.

If you test positive, you may be contacted by the NHS and asked for information to help the NHS alert your close contacts.

### Unclear, void, borderline or inconclusive test result

An unclear, void, borderline or inconclusive result means it’s not possible to say if you had coronavirus when the test was done.

Get another test as soon as possible if this happens. You can get a test to check for coronavirus on GOV.UK.

If you had a test because you had symptoms, you must keep self-isolating and have another test:

• within 8 days of your symptoms starting (England and Northern Ireland)
• within 5 days of your symptoms starting (Scotland and Wales)

If you’re not able to have another test in time, you must self-isolate for at least 10 days from when your symptoms started. Anyone you live with, and anyone in your support bubble, must self-isolate for 14 days. Read more about how long to self-isolate.

If you had a test but have not had any symptoms, you do not need to self-isolate while you wait to get another test. People you live with, and anyone in your support bubble, do not need to self-isolate.

• England: NHS 111 online coronavirus service
• Scotland: NHS inform
• Wales: NHS 111 Wales
• Northern Ireland: get advice from a GP or GP out-of-hours service

Call 999 if you feel very unwell or think there’s something seriously wrong.

### More in Testing and tracing for coronavirus

Page last reviewed: 20 November 2026
Next review due: 27 November 2020

Find out how you get your test result and what your result means if you've had a test to check if you have coronavirus.