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(...)מדפיס הודעה ל-קונסול, חלון לתפוקת טקסט.- הכל לאחר
//הוא תגובת שורת. 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(...)מדפיס; טקסט זקוק לציטוט.//מתחיל תגובה (comment).
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. · לחץ על הרץ כדי לראות את התוצא כאן.