-
Book Overview & Buying
-
Table Of Contents
Professional JavaScript
By :
When building complex applications using JavaScript, there will be times when you need to deal with string manipulation, math calculations, and dates. Luckily, JavaScript has several built-in methods for this type of data. In the following exercises, we will go over the ways we can utilize these in our applications.
To create a new Date object, use the following command:
const currentDate = new Date();
This will point to the current date.
To create a new string, use the following command:
const myString = 'this is a string';
To use the Math module, we can use the Math class:
const random = Math.random();
In this exercise, we will go over some of the ways we can work with strings more easily in our applications. String manipulation and building have always been complex tasks in other languages. In JavaScript, by using String methods, we can create, match, and manipulate strings with ease. In...
Change the font size
Change margin width
Change background colour