Category: JavaScript

JavaScript is the programming language that runs in the browser, which is used to build advanced interactive Web sites and applications for secure browser execution.

Copy to Clipboard (Without Flash) Using Copy Command

Recent versions of the popular browsers (except Safari) now support copy to clipboard natively through the document.execCommand() method. Calling the method with ‘copy’ command will copy the current selection to the clipboard. Before the copy command support was added, developers had to use Flash-based approach such as ZeroClipboard to provide…

Solution for Floating-Point Problems in JavaScript

So you’ve written some absurdly simple JavaScript code, say for example: 0.1 + 0.2 and got a really unexpected result: 0.30000000000000004 instead of 0.3 Why does it happen? In fact, all numbers in JavaScript are double-precision floating-point numbers, which are 64-bit encoding of numbers specified by the IEEE 754 standard….