Math Floor Javascript Method

Math Floor Javascript Method

JavaScript 16-07-2021 Saheb Sutradhar

math.floor javascript

In this post we are going to learn what is Math.floor() in javascript, how we can use it and when we need to use this in real time application.

Javascript Math.floor(value) method takes a number type value as parameter and returns the round off of that value. The return value will be the nearest downward integer.

Example:

<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
		document.write("Output   : " + Math.floor(.60));
</script>
</body>
</html>
Output   : 0

 

Syntax:

Math.floor(value);

Example  1: 

Math.floor(.90);
Output : 0

Example  2: 

Math.floor(-99.91);
Output : -100

Example  3: 

Math.floor(20);
Output : 20

In real time application if you have any requirement where the input id 11.23 and you need to display 11 there you can use javascript Math.floor method.

This method is supported by most of the browsers like Chrome , IE , Safari , Firefox etc.

 

 

I hope this article is helpful for you , i am very glad to help you thanks for reading

 

Related Posts

Card image cap

Spread Operator in JavaScript

JavaScript 20-07-2021 Saheb Sutradhar

In this post we will learn what is spread operator in Javascript? How we can use it ? and Where we should use? Spread Operator allows you to spread out the ele ...

Card image cap

Remove duplicates from array in javascript

JavaScript 24-07-2021 Saheb Sutradhar

In this post i will show you how to remove duplicates from array in javascript.We can use filter() method to remove duplicates from array , if the index of the ...

Card image cap

Next and Previous Buttons in Javascript with Demo

JavaScript 27-07-2021 Saheb Sutradhar

In this post we will learn how to use next and previous buttons in javascript with demo application , the below example there is  image container and next, pre ...

Card image cap

Image size validation in javascript example

JavaScript 28-07-2021 Saheb Sutradhar

In this article you will learn Image size validation in javascript with example , along with the size validation you will learn how to validate image mime type. ...

Card image cap

How to get multiple checkbox value in javascript

JavaScript 30-07-2021 Saheb Sutradhar

In this post you will learn how to get multiple checkbox value in javascript . In many application you will find this kind of feature where we allow user to sel ...

Card image cap

Multiple checkbox validation in javascript

JavaScript 02-08-2021 Saheb Sutradhar

In your application you can use single check box or you can use multiple checkbox . Below examples will help you to understand multiple checkbox validation in j ...