One way to understand what this does it to run it and observe the result.
Here's a JSBin showing 3 examples - which produce a different outcome, depending on the initial value of product
- https://jsbin.com/roruvecubi/edit?js,console
To further clarify this with an explanation...
It will attempt to evaluate that all the following premises are true
at the same time and re-assign product
to the value of id
of the first object found (if these are found) or an empty string if otherwise.
product
array is NOT null
AND
- First element of
product
array is NOT null
AND
- First element of
product
array is an object containing a truthy key-value pair with key id
. I.e. First element could like this:
{
id: "someValue" // product[0].id would be a truthy value in this case
}
AND
- If 3.0 is
true
- assign value of id
. If 3.0 is NOT true
(id: does not contain a truthy object
, array
, number
, string
, true
- Google the precise definition of truthy
), then just assign empty string ""
and thus result will be product = ""
;