두 식의 값을 나눈다.
result=number1/number2
두 수치 number1의 결과값을 number2의 결과값으로 나눈 결과값 수치를 반환한다.
수치중에 하나라도 유효수치가 아니면 결과값은 NaN으로 반환한다.
number1이 0이면 결과값 0을 반환하고, number2가 0이면 결과값 Infinity을 반환한다.
number1도 0이고 number2도 0이면 결과값 NaN을 반환한다.
Infinity등 극한 상황의 계산 결과값은 한계 수치 속성 계산 예제을 참조하라.
![]() | 나누기(/) 연산자⇒ | ![]() | ![]() ![]() ![]() |
<SCRIPT> var a=100/20; document.write(a); // 나눗셈이 됨 document.write('<BR>'); // 줄 바꿈 var s=a/Math.log(a); // 위 결과값을 log(결과값)으로 나눔 document.write(s); document.write('<BR>'); var c=100/' 수치와 문자열의 결합'; // 유효수치가 아니면 NaN을 되돌려 줌 document.write(c); document.write('<BR>'); document.write(12/0); document.write('<BR>'); document.write(0/12); document.write('<BR>'); document.write(0/0); document.write('<BR>'); </SCRIPT>
![]() | 나누기(/) 연산자 | ⇒ | ![]() ![]() |
최종 수정: 05/07/2025 14:14:27 | ![]() All right reserved | 비정상적인 방식으로 프레임없이 페이지에 접속하면 자주 오류가 발생됩니다. 오류가 나면 정상적 접속으로 시도해 보세요. | http://koxo.com/lang/js/operator/divide.html |