Blog

JavaScript – Parsing A Number

If you should ever need to parse a number into an array of bits or a different base you can use the following function: var splitNumber = (function(MAX) {   for (; MAX + 1 – MAX == 1; MAX *= 2){}   return function (num, radix) {     // Validate num     num Read more…

By Chris West, ago
Blog

EcmaScript 6 – Math.sign()

One function I didn’t think would be doable in most browsers was the Math.sign. My main worry was that on the MDN page it specifies a difference between negative zero and positive zero. After doing some research I found this page which helped me realize there is a way to Read more…

By Chris West, ago
Blog

EcmaScript 6 – Array.of()

A function that is proposed to be added to EcmaScript 6 is Array.of(). This function will be used to create an array of the passed parameters. Since this function is available in some browsers but not in all, here is a block of code which when executed will define it Read more…

By Chris West, ago
Blog

EcmaScript 6 – Math.hypot()

Many know that JavaScript features vary from browser to browser. In the case of Firefox, there are many new features that have been proposed in EcmaScript 6. One of them is Math.hypot. This function adds up the squares of each argument passed and returns the square-root of that sum. In Read more…

By Chris West, ago