math ceiling js code example
Example 1: javascript ceiling
var ceiling1 = Math.ceil(4.7); //5
var ceiling2 = Math.ceil(-3.4); //-3
Example 2: js ceil
Math.ceil(1.2);
// 2
Example 3: javascript math ceiling function
Math.ceil()
Example 4: math.ceiling
//Math.ceil is Javascript, and rounds number up:
let someNum = 0.001;
console.log(Math.ceil(someNum)); //prints 1
/*Note: Math.ceil ceil is lowercase, whereas Math.Ceiling Ceiling
is uppercase*/
/*Math.Ceiling is C#, and does the same as Math.ceil, but requires
a decimal or double: */
decimal someDecimal = 2.32m;
Console.WriteLine(Math.Ceiling(someDecimal)); //prints 3
double someDouble = 1.5;
Console.WriteLine(Math.Ceiling(someDouble)); //prints 2
//Sorry for any gramatical issues!