Last active
October 2, 2020 21:06
-
-
Save jerlyrosa/5d6dbd35ba3385a0a7fd171a1789439d to your computer and use it in GitHub Desktop.
Uso de objectos matematicos en javaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Objeto Math | |
console.log(Math.abs(-7.9));//Retorna valor absoluto. | |
console.log(Math.ceil(5.5));//Redondea a un numero mayor. | |
console.log(Math.floor(5.5));//Redondea a un numero menor. | |
console.log(Math.round(7.9)); // Redondea al mas cercano ej: (7.9) = 8; (7.2)= 7; | |
console.log(Math.sqrt(2));// Retorna la raiz cuadra del valor que pasemos. | |
console.log(Math.pow(2,5));// Para elevar potecia. El primer numero la base y el segundo el esponente. | |
console.log(Math.sign(-1));//Idica que tipo de valor es, si positivo = 1, negativo= -1 y cero =0. | |
console.log(Math.random());//Retorna valor aleatorio entre cero y 1 | |
console.log(Math.random() * 100); //Retorna valor aleatorio entre cero y 100. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment