#8 كورس html كامل بالعربي | التعليقات comments
Summary
TLDRIn this video, the speaker explains the concept of comments in programming, particularly within HTML, CSS, JavaScript, and other languages. They demonstrate how to create comments in HTML, explaining that these comments are not displayed in the browser but are useful for providing notes or clarifications for oneself or other developers working on the same project. The speaker also highlights how comments can help in remembering and understanding code, especially when revisiting it after some time. The video also covers the use of keyboard shortcuts for quickly adding comments, making coding more efficient.
Takeaways
- 😀 Comments are a feature available in multiple programming languages, such as HTML, CSS, JavaScript, C++, and Python.
- 😀 In HTML, a comment is created using the syntax: `<!-- comment -->`.
- 😀 Comments do not appear in the browser view, but can be inspected in the page's code.
- 😀 The main purpose of comments is to add notes for yourself or other developers to explain or document code functionality.
- 😀 Comments are useful for remembering code functionality after a period of time or when working with a team.
- 😀 When writing a large and complex codebase, comments help you understand what specific sections of code do.
- 😀 Comments can be used as placeholders to mark sections of code for later modification or testing.
- 😀 You can comment out large sections of code temporarily to see how changes affect your project.
- 😀 To comment out multiple lines quickly, you can use the keyboard shortcut `Ctrl + /` (Windows) or `Cmd + /` (Mac).
- 😀 Using comments helps prevent code errors by allowing you to disable code without deleting it, making testing and debugging easier.
Q & A
What is the purpose of comments in HTML, CSS, JavaScript, and other programming languages?
-Comments are used to annotate and explain code. They are not executed by the browser or compiler but serve as notes to make the code more understandable for the developer and others working on the same project.
How do you write a comment in HTML?
-In HTML, you write a comment using the following syntax: <!-- Your comment here -->. Anything between <!-- and --> will be treated as a comment and will not appear in the browser.
Can you see comments in the browser?
-No, comments do not appear in the browser. They are ignored by the browser during rendering. However, they can be viewed if someone inspects the source code of the page.
Why are comments important in code?
-Comments help make code more readable by explaining what the code does. They serve as reminders for the developer and are particularly useful for collaborative work, ensuring others understand the code's purpose.
How can comments help with long-term code maintenance?
-When developers return to their code after some time, comments remind them of the logic and functionality of the code, reducing the time it takes to understand or modify it.
What is the significance of the comment's visibility in the browser?
-Since comments are not rendered by the browser, they are not visible to the user. This ensures that developers can include explanations and reminders without affecting the user experience.
How do you comment out code to disable it temporarily?
-To comment out code, wrap the code you want to disable with comment tags. In HTML, this would look like: <!-- code here -->. This prevents the code from being executed without deleting it, allowing it to be re-enabled later.
Can you use comments to explain complex or unclear code?
-Yes, comments are often used to explain complex or unclear sections of code, making it easier for others (or even yourself) to understand the code's intent or functionality later.
What are some ways to quickly comment out code in an editor?
-In many code editors, you can use keyboard shortcuts to quickly comment or uncomment lines of code. For example, in Visual Studio Code, you can use Ctrl + / (Windows) or Command + / (Mac) to toggle comments on selected lines.
How does commenting out code help during debugging or testing?
-Commenting out code allows developers to temporarily remove certain functionality while testing or debugging other parts of the application, without permanently deleting the code or causing issues in the codebase.
Outlines

هذا القسم متوفر فقط للمشتركين. يرجى الترقية للوصول إلى هذه الميزة.
قم بالترقية الآنMindmap

هذا القسم متوفر فقط للمشتركين. يرجى الترقية للوصول إلى هذه الميزة.
قم بالترقية الآنKeywords

هذا القسم متوفر فقط للمشتركين. يرجى الترقية للوصول إلى هذه الميزة.
قم بالترقية الآنHighlights

هذا القسم متوفر فقط للمشتركين. يرجى الترقية للوصول إلى هذه الميزة.
قم بالترقية الآنTranscripts

هذا القسم متوفر فقط للمشتركين. يرجى الترقية للوصول إلى هذه الميزة.
قم بالترقية الآنتصفح المزيد من مقاطع الفيديو ذات الصلة
5.0 / 5 (0 votes)