I am by no means an expert at Javascript, but I have been reading Mark 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!

9 Answers
9

Leave a Reply

Your email address will not be published. Required fields are marked *