웹/javascript

Javascript Math, alert, confirm, prompt

SourceTree 2021. 11. 18. 19:53
반응형

Math

Math.floor(Number) //내림
Math.ceil(Number) //올림
Math.round(Number) //반올림
 
var numbers = [ 10, 20, 30 ]
Math.max.apply(null, numbers) //배열중에서 최대값
Math.min.apply(null, numbers) //배열중에서 최소값
 
Math.random() //0 이상 1 미만의 난수
Math.floor(Math.random() * 10) //0~9 정수

 

alert, confirm, prompt

alert('확인 얼럿창');
var jbResult = confirm('확인, 취소 컨펌창');
var jbResult = prompt('입력해주세요.', '');
반응형