Math.floor(Math.random()*256)라는 처음 보는 함수가 있다.Math.floor() 은 floating point(소수)를 내림한 정수로 표현하는 함수이고 Math.random()은 0과 1사이에 랜덤한 숫자를 생성하는 코드이다.Math.floor(Math.random()*10); // 0과 9 사이의 랜덤한 숫자 생성
Math.floor(Math.random()*11); // 0과 10 사이의 랜덤한 숫자 생성
Math.floor(Math.random()*100); // 0과 99 사이의 랜덤한 숫자 생성
Math.floor(Math.random()*101); // 0과 100 사이의 랜덤한 숫자 생성
참고 문서:
https://www.w3schools.com/js/js_random.asp
https://www.w3resource.com/javascript-exercises/javascript-math-exercise-40.php