Chapter 5: New Number Methods

by Aurelio de Rosa

This chapter covers new and improved number methods in ES6 (ECMAScript 6).

I’ll introduce you to the new methods and constants added to the Number data type. Some of the number methods covered, as we’ll see, aren’t new at all, but they’ve been improved and/or moved under the right object (for example, isNaN()). As always, we’ll also put the new knowledge acquired into action with some examples. So, without further ado, let’s get started.

Number.isInteger()

The first method I want to cover is Number.isInteger(). It’s a new addition to JavaScript, and this is something you may have defined and used by yourself in the past. It determines whether the value passed to the function is an integer or not. ...

Get Practical ES6 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.