Converting strings to numbers is extremely common. The easiest and fastest (jsPerf) way to achieve that would be using the
+ (plus) operator.
var one = '1'; var numberOne = +one; // Number 1
You can also use the
- (minus) operator which type-converts the value into number but also negates it.
var one = '1'; var negativeNumberOne = -one; // Number -1
JS runs in a single thread in the browser, this is the truth. In this tip I’ll show you how to unleash the full power of asynchronous processing with Web Workers.
You might have heard about the old ways gaining hype recently, and we don’t mean praying to the gods of the north. Today we’re introducing a feature found in Clojure which allows you to define interfaces for your classes.
Sometimes we need to whitelist certain attributes from an object, say we’ve got an array representation of a database table and we need to
selectjust a few fields for some function.