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) |
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()