In this answer which tests whether or not a page has been cached, I see this variable declaration.
var isCached = currentCookie !== null;
What is the significance of the = and !== operators together in one statement?
In this answer which tests whether or not a page has been cached, I see this variable declaration.
var isCached = currentCookie !== null;
What is the significance of the = and !== operators together in one statement?
that expression means:
isCached is true when currentCookie !== null, false otherwise
you should read it like
var isCached = (currentCookie !== null)
or more verbosely is equivalent to
var isCached;
if (currentCookie !== null) {
isCached = true;
}
else {
isCached = false;
}
That snippet is equivalent with:
var isCached = (currentCookie !== null);
In other words, isCached is set to true if and only if currentCookie is strictly not equal to the null reference.