← 返回首页
Math.SQRT1_2 - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

Math.SQRT1_2

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015년 7월.

Math.SQRT1_2 정적 데이터 속성은 약 0.707의 값을 나타내는 제곱근 1/2을 나타냅니다

In this article

시도해 보기

function getRoot1Over2() { return Math.SQRT1_2; } console.log(getRoot1Over2()); // Expected output: 0.7071067811865476

𝙼𝚊𝚝𝚑.𝚂𝚀𝚁𝚃𝟷_𝟸=12≈0.707\mathtt{Math.SQRT1_2} = \sqrt{\frac{1}{2}} \approx 0.707 Property attributes of Math.SQRT1_2
쓰기 가능불가능
열거 가능불가능
설정 가능불가능

설명

Math.SQRT1_2는 상수이며 Math.sqrt(0.5)과 동일하지만 성능이 더 좋습니다.

SQRT1_2는 Math의 정적 속성이기 때문에 생성한 Math객체(Math는 생성자가 아닙니다)의 속성으로 사용하는 것보다 Math.SQRT1_2로 사용해야 합니다.

예제

Math.SQRT1_2 사용하기

아래 함수는 1 / 2의 제곱근을 반환합니다.

js
function getRoot1_2() { return Math.SQRT1_2; } getRoot1_2(); // 0.7071067811865476

명세서

Specification
ECMAScript® 2027 Language Specification
# sec-math.sqrt1_2

브라우저 호환성

Enable JavaScript to view this browser compatibility table.

같이 보기