Menu
Hi
I’m reading a book about HTML5 and I have found the following expression:
function supports_canvas() {
return !!document.createElement(‘canvas’).getContext;
}
Is ‘!!’ a double negation? In this case, why is that used? Is it not the same that
function supports_canvas() {
return document.createElement(‘canvas’).getContext;
}
I have seen this ‘!!’ more and more in JS code.
Thanks a lot
Isi