Returns the IE version. Tested for IE11 and earlier. - Node.js Environment

Node.js examples for Environment:Browser

Description

Returns the IE version. Tested for IE11 and earlier.

Demo Code

/**//w  ww. j ava  2s.  c  om
 * Returns the IE version. Tested for IE11 and earlier.
 */
function isIE () {
    var match = navigator.userAgent.match(/(?:MSIE |Trident\/.*; rv:)(\d+)/);
    return match ? parseInt(match[1]) : undefined;
}

String.prototype.endsWith = function (s) {
    return this.length >= s.length && this.substr(this.length - s.length) == s;
};

String.prototype.contains = function (s) {
    return this.indexOf(s) > -1;
};

Related Tutorials