44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
let highest = Math.max(2, 56, 12, 1, 233, 4);
|
|
console.log(highest);
|
|
|
|
let lowest = Math.min(2, 56, 12, 1, 233, 4);
|
|
console.log(lowest);
|
|
|
|
let highestOfWords = Math.max("hi", 3, "bye");
|
|
console.log(highestOfWords);
|
|
|
|
let result = Math.sqrt(64);
|
|
console.log(result);
|
|
|
|
let result2 = Math.pow(5, 3);
|
|
console.log(result2);
|
|
|
|
let x = 6.78;
|
|
let y = 5.34;
|
|
console.log("X:", x, "becomes", Math.round(x));
|
|
console.log("Y:", y, "becomes", Math.round(y));
|
|
|
|
console.log("X:", x, "becomes", Math.ceil(x));
|
|
console.log("Y:", y, "becomes", Math.ceil(y));
|
|
|
|
let negativeX = -x;
|
|
let negativeY = -y;
|
|
console.log("negativeX:", negativeX, "becomes", Math.ceil(negativeX));
|
|
console.log("negativeY:", negativeY, "becomes", Math.ceil(negativeY));
|
|
|
|
console.log("X:", x, "becomes", Math.floor(x));
|
|
console.log("Y:", y, "becomes", Math.floor(y));
|
|
|
|
console.log("negativeX:", negativeX, "becomes", Math.floor(negativeX));
|
|
console.log("negativeY:", negativeY, "becomes", Math.floor(negativeY));
|
|
|
|
console.log("X:", x, "becomes", Math.trunc(x));
|
|
console.log("Y:", y, "becomes", Math.trunc(y));
|
|
|
|
let x = 2;
|
|
let exp = Math.exp(x);
|
|
console.log("Exp:", exp);
|
|
let log = Math.log(exp);
|
|
console.log("Log:", log);
|
|
|