10 lines
572 B
Markdown
10 lines
572 B
Markdown
|
---
|
||
|
title: Generate Random Whole Numbers with JavaScript
|
||
|
localeTitle: توليد أرقام كاملة عشوائية مع جافا سكريبت
|
||
|
---
|
||
|
من الرائع أن نتمكن من إنشاء أرقام عشرية عشوائية ، لكن الأمر أكثر فائدة إذا كنا أكثر فائدة لإنشاء رقم صحيح عشوائي.
|
||
|
|
||
|
لتحقيق هذا يمكننا مضاعفة الرقم العشوائي بعشرة واستخدام `Math.floor()` لتحويل الرقم العشري إلى رقم `Math.floor()`
|
||
|
|
||
|
`Math.floor(Math.random()*10)
|
||
|
`
|