Math.round() Method in JavaScript

Math.round() Method in JavaScript

math.round method in javascript; In this tutorial, you will learn about javaScript Math.round Methods & how to use it.

The JavaScript Math.round() function is inbuild javascript function, which is used for returns the value of a given number to the nearest integer.

Math.round method in javaScript

  • JavaScript Math.round() Syntax
  • Math.round() Method Example

Math.round() Syntax

Math.round(var);

This above syntax, you will be see function accepts a single parameter. This is the number that you want to round.

Below we are going to show you some of the javascript math.round() examples.

Math.round() Method Examples

Example 1

In this math.round () function example, we have passed the value in math.round function 6.6 and this function will round off our value and return it to us 7

 var round =Math.round(6.6); 
 document.write("Number After Round : " + round);

Example 2

Let’s see with nagetive value example – In this math.round () function, we have passed the nagetive value in math.round function -6.6 and this function will round off our value and return it to us -7

 var round =Math.round(-6.6); 
 document.write("Number After Round : " + round);

JavaScript Tutorials

Recommended:-JavaScript Arrays

AuthorAdmin

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

Your email address will not be published. Required fields are marked *