Excuse my ignorance, what's the !! for?
Try putting things like these into the address bar of your browser:
javascript:alert(!!null)
javascript:alert(!!undefined)
javascript:alert(!!{})
javascript:alert(!!Math.floor) !!0 -> false
!!1 -> true
!!"" -> false
!!"s" -> true
!!null -> false
!!undefined -> falseAccording to the spec, media.canPlayType returns either "", "maybe" or "probably". An empty string "" is falsy in Javascript and a non-empty string is truthy, but if you try and compare them directly with booleans then you can get some odd behaviour:
if ("yes"){ // true }
if ("yes" == true){ // false }
if ("yes" === true){ // false }
if (""){ // false }
if ("" == false){ // true }
if ("" === false){ // false }
I personally prefer to make sure that any function which you're expecting the return value to be used as a boolean actually returns a boolean value. I know there are many people out there with a dislike of !! though.So you get true if the object exists and false otherwise.