# Working with Built-in Math Functions

Welcome to the "Working with Built-in Math Functions" 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 **Working with Built-in Math Functions** 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.4 Complete and debug code that uses built-in Math functions

### Lab Duration

It will take approximately **30 minutes** to complete this lab.

### Exercise 1 - Using Built-in Math Object Methods

In JavaScript, you can use the Math object if you want to perform mathematical calculations apart from addition, subtraction, multiplication, and division. There are various built-in methods in the Math object that help to perform mathematical tasks in a script. Some of the commonly used Math object methods are as follows:

**Math.abs(x)**- This method returns the positive value of the parameter value.**Math.round(x)**- This method rounds off the parameter value to its nearest integer.**Math.ceil(x)**- This method rounds off the parameter value upwards to its nearest integer.**Math.random()**- This method generates random values that are less than 1 but greater than or equal to 0.**Math.floor(x)**- This method rounds off the parameter value downwards to its nearest integer.

In this exercise, you will learn to use the various built-in Math object methods such as random(), round(x), floor(x), ceil(x), min(x,y,z,…n), max(x,y,z,…n), pow(x,y), and sqrt(x) in JavaScript.

For the purpose of this demonstration, the calculator application does not accept negative numbers. Therefore, the method Math.abs(x) is not included in the application.

You will perform the following tasks:

**Task 1**- You will download the Visual Studio Code workspace (Calculator) from the Intranet and open the HTML page named Calc.html in the Calculator workspace.**Task 2**- You will learn to write JavaScript code to use the various built-in Math object methods in the Calculator application.

### Learning Outcomes

After completing this exercise, you will be able to:

- Use the various built-in Math object methods in JavaScript

See the full benefits of our immersive learning experience with interactive courses and guided career paths.