0

This is a variable declared in my code.

var startDateSet = $(this.parentEl).find('input[name=daterangepicker_start]').val();

I understand that '!' is essentially the same as 'not' but I do not understand what it means when used in this context

if (!this.isStartDateSet) {
    var
    var
    var
    ............

}


does this just mean "if this start date is not set?"

thanny
  • 11
  • 3

2 Answers2

1

It would mean:

If isStartDateSet is falsy

Here is the list of falsy values:

  1. false
  2. 0
  3. 0n
  4. "", '', ``
  5. null
  6. undefined
  7. NaN

More information here: https://stackoverflow.com/a/35642837/7919626

Word Rearranger
  • 1,306
  • 1
  • 16
  • 25
0

var startDateSet = $(this.parentEl).find('input[name=daterangepicker_start]').val();

This is checking if you have set a Starting or Beginning Date-Time on your input.

(like if you have put a start value into the input, or if it has no value at the moment)

Then, the function:

if (!this.isStartDateSet) {
    var
    var
    var
    ............

}

Is checking if there is NOT a starting date set, and is executing code inside of the conditional If statement.

Mister SirCode
  • 1,575
  • 14
  • 31