제곱근 값을 반환한다.

Script[fpVal=]Math.sqrt(number)
인수/파라메터
number

필수적인 number 인수는 필요한 수치, 수치개체나 수식이 될 수 있다.

반환값

반환값 fpValnumber 인수의 제곱근값이다.

인수가 제공되지 않거나 유효수치가 아니면 NaN을 반환한다.

구문 예제
10
document.write(Math.sqrt(100));

100의 제곱근을 구하는 수식으로 값 10을 반환한다.



method
sqrt 메서드
sqrt</b> 메서드이전페이지로페이지 맨위로페이지 맨아래로

간단한 sqrt 메서드 예제

Math.sqrt(10000)=100
Math.sqrt("0.0001")=0.01
Math.sqrt(-100)=NaN
Math.sqrt("10,000")=NaN
Math.sqrt(Math.pow(10,4))=100
Math.sqrt()=NaN
<SCRIPT>
var br='<BR>'; // 줄바꿈
var str=''; // 출력 문자열 변수 선언
str+='Math.sqrt(10000)='+Math.sqrt(10000)+br; // 10000의 제곱근
str+='Math.sqrt("0.0001")='+Math.sqrt("0.0001")+br; // 0.0001의 제곱근
str+='Math.sqrt(-100)='+Math.sqrt(-100)+br; // -100의 제곱근, 가능하지 않으므로 NaN
str+='Math.sqrt("10,000")='+Math.sqrt("10,000")+br; // 컴마가 있어 유효수치가 아니므로 NaN
str+='Math.sqrt(Math.pow(10,4))='+Math.sqrt(Math.pow(10,4))+br; // 10에 4번 거듭 제곱(104)의 제곱근
str+='Math.sqrt())='+Math.sqrt()+br; // 인수가 제공되지 않아 반환값은 NaN

document.write(str); // 결과 문자열 출력
</SCRIPT>
method
sqrt 메서드
견본
이전페이지로페이지 맨위로
최종 수정:
05/14/2025 21:23:30
KoXo Homepage
All right reserved
비정상적인 방식으로 프레임없이 페이지에 접속하면 자주 오류가 발생됩니다.
오류가 나면 정상적 접속으로 시도해 보세요.
http://koxo.com/lang/js/method/sqrt.html