Get the latest tech news

The big and Small of JavaScript numbers (2017)


For all its warts, JavaScript has some novelties few other languages have. In this post I want to share about JavaScript numbers, which both acknowledge normal mathematics and the fact that they ar…

In this post I want to share about JavaScript numbers, which both acknowledge normal mathematics and the fact that they are represented by an imperfect data format. While I encourage you to read the MDN article on Number, I want to provide a few patterns I have found useful when working in JavaScript that I can’t often use in other languages. Again, we have a single expression valid for all inputs which also indicates our intention: to constrain a within certain bounds (the if provides no such context apart from reading the code within).

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Small

Small

Photo of javascript

javascript

Photo of JavaScript numbers

JavaScript numbers

Related news:

News photo

Proposal: JavaScript Structs

News photo

Show HN: Tenno – Markdown and JavaScript = a hybrid of Word and Excel

News photo

Tiny Texture Tumbler – JavaScript procedural texture library and editor