JavaScript
A guide to javascript fundamentals.
JavaScript (JS) is a lightweight, interpreted, and object-oriented programming language used primarily to create dynamic and interactive content on websites. Along with HTML (structure) and CSS (styling), it is one of the three core technologies of the World Wide Web.
Core Features
Section titled “Core Features”-
Interpreted & Versatile: Code is executed line by line at runtime, meaning it doesn’t need to be compiled before running.
-
Dynamic Interactivity: It allows you to create features that move, refresh, or change without manual page reloads, such as pop-ups, sliders, and form validations.
-
Cross-Platform: While originally built for web browsers (client-side), it is now widely used for server-side development through environments like Node.js.
-
Asynchronous: It can handle background tasks, like fetching data from a server, without freezing the user interface.
How It Works
Section titled “How It Works”JavaScript is applied to an HTML page using the <script> tag. You can see it in action by opening your browser’s developer console and typing simple commands.
Common Actions:
Section titled “Common Actions:”- Selecting Elements: Use
document.getElementById("name")to “find” an element on the page. - Changing Content: Update what a user sees by modifying properties like
innerHTMLortextContent. - Logging Data: Use
console.log()to print messages to the console for debugging.