data types, such as Numbers, Strings, and Booleans. Let's look at the Math, Date, and Random objects, which can be incredibly useful.
The Math objects provides us with the tools necessary to easily perform mathematical calculations.
> Math.ceil(Math.PI) 4 > Math.sqrt(Math.PI) 1.7724538509055159
The Math.random() method calculates a random number between 0 and 1. Thus, to get a number between 1 and 10, we can multiple our decimal value by 10 and use the floor() method to get a whole integer value, then add 1.
> Math.random() 0.5574872007127851 > Math.floor((Math.random() * 10) + 1) 7
Date object allows us to find and manipulate the date. This includes finding the days of the week, time, current year, etc.
When working with Dates, you must instantiate a
Date object with the
new keyword. This new
Date object will hold the current date and time.
There are several ways you can instantiate a
Date object. Note that some values have a zero-based index (such as month), while others don't (like date).
> var date = new Date(2009, 9, 13, 3, 34, 44) > date.toDateString() "Tue Oct 13 2009" > var date = new Date(2019, 9, 13) > date.toDateString() "Tue Oct 13 2019" > var date = new Date('Mar 23, 1992 19:23:42') > date.toDateString() "Mon Mar 23 1992"
Wed Mar 15 2003
Responsive web design helps your site maintain its design integrity on a variety of screen sizes, but how does it affect your typography? With this practical book, graphic designers, web designers, and front-end developers alike will learn the nuts and bolts of how to get the best appearance from type without sacrificing performance on any device.$ Check price
Relieve spasms, tight muscles, trigger points and pressure points with the Body Back Buddy! This trigger point massage is designed to help you self-message any area of your body - especially those that are hard to reach. Keeping your muscles relaxes and out of contraction is importan in helping to reduce pain and prevent muscle injury.$ Check price