
x32x01
أدارة أكتب كود
- بواسطة x32x01 ||
كيف يتم كتابة 1000000 بعدة طرق في js ؟

JavaScript:
console.log(100_000); // 100000
console.log(100000); // 100000
console.log(5e4 + 5e4);
ما ھو مفھوم كل من NaN و infinity ؟

جافاسكربت حين يجد أن العدد كبير جداً و يفوق القدرة الإستيعابية للتخزين فإنه يستبدله بالقيمة Infinity و حين يجد أن العدد صغير جداً و يفوق القدرة الإستيعابية له فإنه يستبدله بالقيمة -Infinity.
الكلمة NaN هي اختصار لعبارة Not A Number و التي تعني أن الناتج على العملية الحسابية ليس عدداً يمكن تمثيله.
في خواص Number ما ھي وظيفة كل من
1- Number.MAX_SAFE_INTEGER

2-
Number.isNaN()

True : في حالة اذا كانت القيمة هي ليست عدد
false : في حالة اذا كانت القيمة هي عدد
3-
Number.isInteger()

إذا كانت القيمة NaN أو Infinity ، فستقوم بإرجاع false.
4-
Number.tofixed (2)

مثال console.log (100.55544.tofixed(2))
الناتج رح يكون 100.55
5-
Number. tostring()

وممكن تنكتب بطريقتين
Console.log((100).tostring())
الطريقة الثانية
Console.log(100..tostring())
هنا كتبنا نقطتين حتى نفھم اللغة انھا مش كسور او ارقام عشرية لأن النقطة الواحدة تدل على اني ھكمل على رقم ١٠٠ برقم عشري أو فيه كسور
6-
Number.parseInt("100")

وكلمة parse يعني تحليل وال int يعني رقم صحيح
يعني يرجع في الناتج فقط ارقام صحيحة
7-
Number. parseFloat()

8-
Number.EPSILON()

في خواص Math object ما ھي وظيفة كل من
1- Math.round()

Console.log( Math.round(99.2))
ھنا الناتج يكون 99
Console.log(Math.round(99.5))
ھنا الناتج يكون 100
2-
Math.Ceil()

Console.log(Math.ceil(99.3))
الناتج يكون 100
3-
Math.Floor()

Console.log(Math.ceil(99.8))
الناتج يكون 99
4-
Math.min()

5-
Math.max()

6-
Math. Pow()

Console.log( Math.pow(2,4))
أول قيمة الرقم وثاني القيمة الأس
الناتج يكون 16
7-
Math.random()

8-
Math.trunc()

في خواص String ما ھي وظيفة كل من
Str="Ahmed" ال index يبدأ من الصفر
1-
str.length()

الناتج ھو 5
2-
str.charAt(1)

يعني تعطي البوزيشن وھو يرجع القيمة
ھنا كتبنا 1 يعني رح يرجع h
3-
str.toUpperCase()

4-
str.toUpperCase()

5-
str.indexOf("h")

ھنا الناتج يكون 1
6-
str.slice(0,3)

لازم تحدد قيمة ليھا اجباري يبدأ فيھا بداية القطع ولكن تحديد النھاية إختياري
الناتج ھنا يكون Ahm
رقم 3 اللي كتبناھا للنھاية مش ھيتعمل لھا include يعني يقف عند رقم 2
8-
str.split()

9-
str.repeat()

10-
str.trim()

11-
str.substr()

12-
str.substring()

ما ھي الفرق بين = و == و === ؟

ما هو الفرق بين = و == و === في البرمجة ؟؟!
1- اشارة =
في أغلب لغات البرمجة, استخدام إشارة اليساوي لوحدها تستخدم لتعيين قيمة ما لمتغير. مثال على هذه اللغات PHP, C/++, Java, Javascript, Python. مثال: x=5 وتعني قيمة x تساوي 5
2- اشارة ==
تستخدم للمقارنه بين قيمتين .وتعني : تفحص ما إن كان الشيئان ما قبل وبعد الإشارة متساويان مثل x==5 وهنا تعني فحص قيمة x هل هي تساوي 5
3- الاشارة ===
تستخدم لمقارنة الهوية .يعني : لتأكد إنه القيمتين نفسها(متساويتان ) ولهم نفس النوع. مثال 5===5
ما ھي طريقة كتابة if الشرطية ؟

Code:
if ( ){
}
if تُكتب في بداية الشرط
بين اﻷقواس () يوضع الشرط
إذا كان الشرط يساوي true سيقوم المفسر بتنفيذ ما بين الأقواس {} ثم يُكمل باقي الكود
إن كان الشرط يساوي false سيتجاهل المفسّر ما بين اﻷقواس {} ويكمل.
بإختصار الشروط تُحدد للمفسّر كتلة من اﻷوامر يقوم بتنفيذها فقط إذا كان ما بين اﻷقواس يساوي true
كيف تعمل else ؟

لا يمكن أن تأتي else بدون if، ﻷنها مرتبطة بها في الشرط وفي كل شيء... ولكن يمكن أن تأتي if بدون else.