JS Getting Started

Learn how to start writing and running JavaScript code.

Examples

Internal Script

Writing JavaScript directly inside an HTML file.

<!DOCTYPE html>
<html>
<body>
  <h2>Internal Script</h2>
  <button type="button" onclick="alert('Hello World!')">Click Me!</button>
</body>
</html>

Changing HTML Content

Using JavaScript to interact with HTML elements.

<!DOCTYPE html>
<html>
<body>
<h2>My First JavaScript</h2>
<button type="button" onclick="document.getElementById('demo').innerHTML = Date()">
Click me to display Date and Time.
</button>
<p id="demo"></p>
</body>
</html>

Console Log

Writing to the browser console for debugging.

console.log("Hello from the console!");

Test Your Knowledge

JavaScript Quiz

No quiz available for this topic yet.