Formatting Numbers
Welcome to the "Formatting Numbers" Practice Lab. In this module you will be provided with the instructions and devices needed to develop your hands-on skills.
Already have an account? Sign In »

Introduction
Welcome to the Formatting Numbers Practice Lab. In this module you will be provided with the instructions and devices needed to develop your hands-on skills.
Exam Objectives
The following exam objective is covered in this lab:
2.1 Declare and use variables of primitive data types
Lab Duration
It will take approximately 15 minutes to complete this lab.
Exercise 1 - Formatting Numbers
You can format the numbers in JavaScript by using the various built-in methods such as toFixed() and toPrecision().
The toFixed() method helps to display the number with the required number of decimal values. This method returns a string value. The toFixed() method takes a single parameter. You can also use this method without any parameter.
The toPrecision() method helps to display the number with the required length or precision. This method also returns a string value. The toPrecision() method takes a single parameter that is optional.
In this exercise, the first task will be to download the Visual Studio Code workspace from the Intranet and create a new HTML page named Formatnum.html in the Calculator workspace.
In the second task, you will write JavaScript code to use the built-in number methods to format the numbers.
Learning Outcomes
After completing this exercise, you will be able to:
Use the JavaScript number methods to format numbers
See the full benefits of our immersive learning experience with interactive courses and guided career paths.