Can someone explain this 'double negative' trick?
- by ProfessionalAmateur
Hello, I am by no means an expert at javascript, but I have been reading Dave Pilgrim's "Dive into HTML5" webpage and he mentioned something that I would like a better understanding of.
He states:
"Finally, you use the double-negative trick to force the result to a Boolean value (true or false)."
function supports_canvas() {
return !!document.createElement('canvas').getContext;
}
If anyone can explain this a little better I would appreciate it!