Unfortunately sometime is pretty useful to understand if the JavaScript is executed into Internet Explorer and the version of the browser, you can recover all this information with the usage of regular expressions.
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){
var version = new Number(RegExp.$1);
// Do whatever you want with the version information
}

