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.sqrt()

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.sqrt() ํ•จ์ˆ˜๋Š” ์ˆซ์ž์˜ ์ œ๊ณฑ๊ทผ์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

โˆ€xโ‰ฅ0,Math.sqrt(x)=x=the uniqueyโ‰ฅ0such thaty2=x\forall x \geq 0, \mathtt{Math.sqrt(x)} = \sqrt{x} = \text{the unique} ; y \geq 0 ; \text{such that} ; y^2 = x

๋ฌธ๋ฒ•

js
Math.sqrt(x);

๋งค๊ฐœ๋ณ€์ˆ˜

x

์ˆซ์ž.

๋ฐ˜ํ™˜ ๊ฐ’

์ฃผ์–ด์ง„ ์ˆซ์ž์— ๋ฃจํŠธ(โˆš )๋ฅผ ์”Œ์›๋‹ˆ๋‹ค. ๋งŒ์•ฝ ์ˆซ์ž๊ฐ€ ์Œ์ˆ˜์ด๋ฉด NaN๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

์„ค๋ช…

๋งŒ์•ฝ x ๊ฐ€ ์Œ์ˆ˜๋ผ๋ฉด Math.sqrt() ํ•จ์ˆ˜๋Š” NaN๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

sqrt()๋Š” Math์˜ ์ •์  ๋ฉ”์„œ๋“œ ์ด๋ฏ€๋กœ ๋งŒ๋“  Math ๊ฐ์ฒด์˜ ๋ฉ”์„œ๋“œ๊ฐ€ ์•„๋‹ˆ๋ผ ํ•ญ์ƒ Math.sqrt()ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค. (Math๋Š” ์ƒ์„ฑ์ž๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.)

์˜ˆ์ œ

Math.sqrt()

js
Math.sqrt(9); // 3
Math.sqrt(2); // 1.414213562373095

Math.sqrt(1); // 1
Math.sqrt(0); // 0
Math.sqrt(-1); // NaN

๋ช…์„ธ์„œ

Specification
ECMAScriptยฎ 2026 Language Specification
# sec-math.sqrt

๋ธŒ๋ผ์šฐ์ € ํ˜ธํ™˜์„ฑ

์ฐธ์กฐ