How to specify multiple conditions in an if statement in javascript
Just add them within the main bracket of the if statement like:
if ((Type == 2 && PageCount == 0) || (Type == 2 && PageCount == '')) {
PageCount = document.getElementById('<%=hfPageCount.ClientID %>').value;
}
Logically, this can be rewritten in a better way too! This has exactly the same meaning:
if (Type == 2 && (PageCount == 0 || PageCount == '')) {
Here is an alternative way to do that.
const conditionsArray = [
condition1,
condition2,
condition3,
]
if (conditionsArray.indexOf(false) === -1) {
"Do something"
}
Or ES7 (or later):
if (!conditionsArray.includes(false)) {
"Do something"
}