How to detect Safari, Chrome, IE, Firefox and Opera browser?

Googling for browser reliable detection often results in checking the User agent string. This method is not reliable, because it’s trivial to spoof this value.I’ve written a method to detect browsers by duck-typing. Only use the browser detection method if it’s truly necessary, such as showing browser-specific instructions to install an extension. Use feature detection when possible. Demo: https://jsfiddle.net/6spj1059/  Run … Read more

How can I get file extensions with JavaScript?

Newer Edit: Lots of things have changed since this question was initially posted – there’s a lot of really good information in wallacer’s revised answer as well as VisioN’s excellent breakdown Edit: Just because this is the accepted answer; wallacer’s answer is indeed much better: My old answer: Should do it. Edit: In response to PhiLho’s comment, use something like:

Does parseDouble exist in JavaScript?

It’s not possible to natively deal with a 21-digit precision number in JavaScript. JavaScript only has one kind of number: “number”, which is a IEEE-754 Double Precision (“double”) value. As such, parseFloat in JavaScript is the equivalent of a “parse double” in other languages. However, a number/”double” only provides 16 significant digits (decimal) of precision and so reading in a number with 21-digits will lose the 5 … Read more

What is “assert” in JavaScript?

There is no standard assert in JavaScript itself. Perhaps you’re using some library that provides one; for instance, if you’re using Node.js, perhaps you’re using the assertion module. (Browsers and other environments that offer a console implementing the Console API provide console.assert.) The usual meaning of an assert function is to throw an error if the expression passed into the function is false; … Read more