console.log and comments · console.log والتعليقات
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · تحتاج هذه الصفحة إلى متصفح حديث (يدعم SharedArrayBuffer). يرجى تحديث Chrome أو Edge أو Firefox أو Safari إلى أحدث إصدار.
English
The language of the web
- JavaScript runs inside every web browser. It makes pages do things — buttons, games, maps, chat.
console.log(...)prints a message to the console, a window for text output.- Anything after
//is a comment. JavaScript ignores it — it is a note for humans reading the code.
العربية
لغة الويب
- JavaScript يعمل داخل كل متصفح ويب. يجعل الصفحات تفعل أشياء - أزرار، ألعاب، خرائط، دردشة.
console.log(...)يطبع رسالة على لوحة التحكم (console)، وهي نافذة لمخرجات النص.- أي شيء بعد
//هو تعليق. JavaScript يتجاهله - إنه ملاحظة للبشر الذين يقرأون الكود.
console.log("Hello, world!"); // → Hello, world!
// this whole line is a comment — it does nothing
English
Print text, numbers, or both
- Text goes inside quotes:
"hello". Numbers do not:42. - Pass several items separated by commas — they print on one line, with a space between.
العربية
اطبع نصاً، أرقاماً، أو كليهما
- النص داخل علامات التنصيص:
"hello". الأرقام لا:42. - مرر عناصر متعددة مفصولة بفواصل - تطبع في سطر واحد، مع مسافة بينهما.
console.log("Score:", 42); // → Score: 42
console.log(3 + 4); // → 7
English
Watch out
- Text needs quotes.
console.log(Hello)is an error — JavaScript hunts for something namedHello. - End each statement with a semicolon
;. It is a good habit, even where JavaScript would forgive you.
العربية
انتبه
- النص يحتاج علامات تنصيص.
console.log(Hello)هو خطأ - JavaScript يبحث عن شيء مسمىHello. - انهِ كل جملة بنقطة منقوطة
;. إنها عادة جيدة، حتى حيث يعفو JavaScript.
English
Common mistakes
console.log(...)prints; text needs quotes.//starts a comment.
العربية
أخطاء شائعة
console.log(...)يطبع؛ النص يحتاج علامات تنصيص.//يبدأ تعليقاً.
English
Now you try
- Use
console.log(...)to print. - Press Run to see the output, then Check answer.
العربية
الآن جرب بنفسك
- استخدم
console.log(...)للطباعة. - اضغط على Run لرؤية المخرجات، ثم اضغط على Check answer.
Use console.log(...) to print the word Hello. · استخدم console.log(...) لطباعة كلمة Hello.
Click Run to see the output here. · اضغط تشغيل لرؤية المخرجات هنا.
Print Red, Green and Blue, one per line, in that order. · اطبع Red، Green و Blue، واحدًا لكل سطر، بنفس الترتيب.
Click Run to see the output here. · اضغط تشغيل لرؤية المخرجات هنا.
Print the result of 5 + 3 (it is 8). · أخرج نتيجة 5 + 3 (وهي 8).
Click Run to see the output here. · اضغط تشغيل لرؤية المخرجات هنا.