Math min()

The Math.min() method is used to return the lowest-valued number passed in the method. The Math.min() method returns NaN if any parameter isn’t a number and can’t be converted into one. The min() is a static method of Math, therefore, it is always used as Math.min(), rather than as a method of a Math object created.

Javascript




value = Math.min (50, 90, -1, 100)
console.log("The min value among (50, 90, -1, 100) is : " + value)


Output

The min value among (50, 90, -1, 100) is : -1

Explain various math functions that can be used in CoffeeScript

CoffeeScript is a lightweight language that compiles into JavaScript. As compared to JavaScript, it provides simple and easy-to-learn syntax avoiding the complex syntax of JavaScript. CoffeeScript is influenced by languages such as JavaScript, YAML, Ruby, Python and has also influenced languages that are LiveScript, MoonScript.

Installation of CoffeeScript:

To install locally, use the below command:

npm install --save-dev coffeescript

What are math functions in CoffeeScript?

Math object of JavaScript provides different properties and methods to perform mathematical tasks on numbers. This Math object is static so it does not have a constructor. We can access all the methods and properties of the Math object without creating an object of it. As we know, the golden rule of CoffeeScript is: “It’s just JavaScript.” So we can use all the JavaScript math methods in CoffeeScript.

Syntax:

Math.method(number)

In the above syntax, Math is class along with method names and pass argument as integer number 

Below are the various math functions that can be used in CoffeeScript:

Table of Content

  • Math.abs()
  • Math.ceil( )
  • Math floor()
  • Math log()
  • Math max()
  • Math min()
  • Math pow()
  • Math round()

Similar Reads

Function 1: Math.abs()

The Math.abs() method is used to return the absolute value of a number. It takes a number as its parameter and returns its absolute value....

Function 2: Math.ceil( )

...

Function 3: Math floor()

The Math.ceil() function in JavaScript is used to round the number passed as a parameter to its nearest integer in Upward direction of rounding i.e towards the greater value....

Function 4: Math log()

...

Function 5: Math max()

The Math.floor method is used to round off the number passed as a parameter to its nearest integer in Downward direction of rounding i.e. towards the lesser value....

Function 6: Math min()

...

Function 7: Math pow()

The Math.log() method used to return the natural logarithm (base e) of a number. The JavaScript Math.log() method is equivalent to ln(x) in mathematics. If the value of x is negative, then math.log() method return NaN....

Function 8: Math round()

...

Contact Us