Replaced "const" with "var" to make it work in IE8-IE10 too.