Files
freeCodeCamp/guide/arabic/javascript/standard-objects/math/math-max/index.md
2018-10-16 21:32:40 +05:30

52 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Math Max
localeTitle: الرياضيات ماكس
---
## الرياضيات ماكس
`Math.max()` دالة تقوم بإرجاع أكبر قيمة من قائمة القيم الرقمية التي تم تمريرها كمعلمات. إذا تم تمرير قيمة غير رقمية كمعلمة ، `Math.max()` `NaN` .
يمكن تمرير صفيف من القيم الرقمية كمعلمة مفردة إلى `Math.max()` باستخدام أي من `spread (...)` أو `apply` . ومع ذلك ، قد تفشل أي من هاتين الطريقتين عندما يكون مقدار قيم الصفيف عاليًا جدًا.
### بناء الجملة
`Math.max(value1, value2, value3, ...);
`
### المعلمات
أرقام ، أو مجموعة محدودة من الأرقام.
### قيمة الإرجاع
أعظم القيم الرقمية المعطاة ، أو `NaN` إذا كانت قيمة معينة غير رقمية.
### أمثلة
_الأرقام كمعلمات_
`Math.max(4, 13, 27, 0, -5); // returns 27
`
_معلمة غير صالحة_
`Math.max(4, 13, 27, 'eight', -5); // returns NaN
`
_صفيف كمعلمة ، استخدام السبريد (…)_
`let numbers = [4, 13, 27, 0, -5];
Math.max(...numbers); // returns 27
`
_صفيف كمعلمة ، باستخدام تطبيق_
`let numbers = [4, 13, 27, 0, -5];
Math.max.apply(null, numbers); // returns 27
`
#### معلومات اكثر:
[MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max)