javascript - What's the purpose of two exclamation marks before a variable? -


this question has answer here:

i'm studying todomvc source , came across helper:

// addeventlistener wrapper: window.$on = function (target, type, callback, usecapture) {   target.addeventlistener(type, callback, !!usecapture); }; 

what's !!usecapture?

the double exclamation mark forces truthy/falsey value boolean. think of !(!usecapture), or not (not use capture).


Comments