Reputation: 153
Whilst updating Google Analytics from async version to universal, I came across this event tracking line, written by someone else years ago.
_gaq.push(["_trackEvent", "Social Widget Share", "Shared to Facebook", "Share to Facebook via the Social Driver Widget", 0, !0])
My understanding is that the last element is to indicate a Non-Interaction event with "true" otherwise it is left out of the array.
I have never seen !0 and I can not find any indication searching here or elsewhere on the web that !0 is a thing when it comes to Boolean notation - or analytics event tracking.
Upvotes: 0
Views: 613
Reputation: 12022
Yes, that's correct and please have a look at some of the true
and false
values below
// False values
console.log('False values');
console.log(Boolean(false));
console.log(Boolean(0));
console.log(Boolean(!!0));
console.log(Boolean(!1));
console.log(Boolean(''));
console.log(Boolean(null));
console.log(Boolean(undefined));
// True values
console.log('True values');
console.log(Boolean('0')); // string variable
console.log(Boolean(!0));
console.log(Boolean(1));
console.log(Boolean(!!1));
console.log(Boolean(true));
Upvotes: 3
Reputation: 542
Yes !0 is always true , since 0 is false, Its a way to write true or 1 as boolean
Upvotes: 0