javascript Math object in hindi

Javascript Math object in hindi:-

आज हम इस पोस्ट में javascript math object के बारें में पढेंगे तो चलिए शुरू करते है:-

javascript math object गणितीय नियतांकों तथा functions का एक collection होता है जिनके द्वारा हम tasks परफॉर्म करते है जैसे:- random number जनरेट करना, rounding, तथा अन्य कैलकुलेशन को पूरा करना.

math एक constructor नहीं है. math की सभी properties तथा functions जो है वह static होती है तथा इन्हें math के objects के रूप में प्रयोग करके call किया जा सकता है.

जैसे:- Math.PI, Math.random(), Math.pow() आदि.

Math methods in hindi:-

कुछ javascript math object methods निम्नलिखित  है:-

1:- Math.abs()- यह मेथड एक number की absolute वैल्यू को return करता है.

उदाहरण:

<!DOCTYPE html>
<html>
<head>
<title>javascript Math abs</title>
</head>
<body>
<script>
var value = Math.abs(5.5);
document.write(value);
</script>
</body>
</html>

आउटपुट: 5.5

2:- Math.acos():-

यह मेथड number का arccosine return करती है.

<!DOCTYPE html>
<html>
<head>
<title>javascript Math acos</title>
</head>
<body>
<script>
var value = Math.acos(-1);
document.write(value);
</script>
</body>
</html>

आउटपुट: 3.14592653589793

इस प्रकार आप अन्य values का arccosine निकाल सकते हो.

3:- Math.random()-

Math.random() जो है वह 0 तथा 1 के बीच में random नंबर return करती है.

<!DOCTYPE html>
<html>
<head>
<title>javascript Math random</title>
</head>
<body>
<script>
var value = Math.random();
document.write(value);
</script>
</body>
</html>

4:- Math.min()-

Math.min() का प्रयोग arguments की लिस्ट में से lowest वैल्यू को ढूंडने के लिए किया जाता है.

<!DOCTYPE html>
<html>
<head>
<title>javascript Math min</title>
</head>
<body>
<script>
var value = Math.abs(21,10,-50,-100,0,400);
document.write(value);
</script>
</body>
</html>

आउटपुट: -100

5:- Math.max()-

Math.max() का प्रयोग arguments की list में से highest वैल्यू को ढूंडने के लिए किया जाता है.

<!DOCTYPE html>
<html>
<head>
<title>javascript Math max</title>
</head>
<body>
<script>
var value = Math.abs(400,50,501,45,-67,0,98);
document.write(value);
</script>
</body>
</html>

आउटपुट: 501

6:- Math.sin()-

इस method का प्रयोग किसी number का sine return करने के लिए किया जाता है. यह मेथड -1 तथा 1 के मध्य वैल्यू को return करता है.

<!DOCTYPE html>
<html>
<head>
<title>javascript Math sin</title>
</head>
<body>
<script>
var value = Math.sin(90);
document.write(value);
</script>
</body>
</html>

आउटपुट: 0.8939966636005578

7:- Math.cos()-

Math.cos() मेथड number का cosine return करती है. यह मेथड -1 तथा 1 के मध्य वैल्यू को return करती है.

<!DOCTYPE html>
<html>
<head>
<title>javascript Math cos</title>
</head>
<body>
<script>
var value = Math.cos(90);
document.write(value);
</script>
</body>
</html>

आउटपुट: -0.4480736161291702

8:- Math.tan()-

Math.tan() मेथड number का tangent return करती है.

<!DOCTYPE html>

<html>

<head>

<title>javascript Math tan</title>

</head>

<body>

<script>

var value = Math.tan(45);

document.write(value);

</script>

</body>

</html>

आउटपुट: 1.6197751905438615

9:-  Math.round()-

Math.round() मेथड जो है वह number की सबसे नजदीकी rounded वैल्यू को return करता है.

उदहारण:- 1:-

<!DOCTYPE html>

<html>

<head>

<title>javascript Math round</title>

</head>

<body>

<script>

var value = Math.round(5.5);

document.write(value);

</script>

</body>

</html>

आउटपुट:- 6

उदहारण:-

<!DOCTYPE html>

<html>

<head>

<title>javascript Math round</title>

</head>

<body>

<script>

var value = Math.round(5.4);

document.write(value);

</script>

</body>

</html>

आउटपुट:- 5

10:- Math.sqrt()-

Math.sqrt() मेथड number के square root (वर्ग मूल) को return करता है.

<!DOCTYPE html>

<html>

<head>

<title>javascript Math sqrt</title>

</head>

<body>

<script>

var value = Math.sqrt(81);

document.write(value);

</script>

</body>

</html>

आउटपुट:- 9

यह भी पढ़ें:- जावास्क्रिप्ट तथा जावा के मध्य क्या अंतर है?

इनके अलावा भी javascript math object methods है जो निम्न है:-

  • PI
  • asin()
  • atan()
  • atan2()
  • ceil()
  • floor()
  • exp()

निवेदन: आपके लिए javascript math object यह पोस्ट helpful रही हो तो कमेंट के द्वारा बताइए तथा इसे अपने दोस्तों के साथ share करें. धन्यवाद.

2 thoughts on “javascript Math object in hindi”

    • brother rondom method me 0 se 1 ke bich .desible me number pass karti he or desible hatane ke liye aap ko math.floor ka use karna padega *10 ke sath !!

      like this => console.log(Math.floor(Math.rondom() * 10));

      Reply

Leave a Comment