Skip to content

Instantly share code, notes, and snippets.

@NV
Created November 23, 2009 10:54
Show Gist options
  • Save NV/241007 to your computer and use it in GitHub Desktop.
Save NV/241007 to your computer and use it in GitHub Desktop.
IE, Opera, Chrome doesn't remove comments after function.toString() coercion
function f(){/* comment */}
alert(f+'');
// Opera, IE, Chrome: function f(){/* comment */}
// Firefox, Safari: function f(){}
//
// Note: in Firefox: f+'' === f.toSource()
function square (x/*:Number*/)/*:Number*/ {
return x*x
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment