-1

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")
asikuna
  • 23
  • 3
  • That is a NOT. It reverses your result. You read it as "NOT To Lower Case." So if toLowerCase returns true, the NOT reverses that to FALSE. – Robert Harvey Apr 19 '22 at 22:15
  • includes return true or false, above statement says not includes "conditional" – Nonik Apr 19 '22 at 22:15

2 Answers2

1

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'
mstephen19
  • 1,733
  • 1
  • 5
  • 20
0

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.

fmsthird
  • 1,745
  • 2
  • 17
  • 34