I'm using ParseHub to get links in a conditional manner. I can only extract the URL using a condition in this format, and I'm wondering why I need the exclamation point at the front?
!toLowerCase($e.text).includes("conditional")
I'm using ParseHub to get links in a conditional manner. I can only extract the URL using a condition in this format, and I'm wondering why I need the exclamation point at the front?
!toLowerCase($e.text).includes("conditional")
The exclamation point negates the expression. You're saying with this line of code that "if the text does not include the string 'conditional'
, do something..."
An easy way to demonstrate this is with this line of code:
console.log(!true);
We are flipping the condition. So true
is obviously true, but !true
is equal to false
, since it's been flipped.
The !
is called bang or the not operator, and you can read about it here
const string = 'hello world'
// does it include 'hello'?
console.log(string.includes('hello')) // true! it does include 'hello'
// does it NOT include 'hello'?
console.log(!string.includes('hello')) // false. it does include 'hello'
I believe the exclamation point is more of a javascript thing here. Looking at your code snippet it means it negates the .includes
result. If it's true, it will be reversed to false and vice versa.