Welcome to JavaScript! JavaScript is a versatile programming language that helps developers add interactive features to websites. It can be used for simple tasks like showing alerts to creating full-featured applications.
JavaScript was created in 1995 and has since become the most widely-used programming language for web development. Along with HTML and CSS, JavaScript forms the "holy trinity" of the web, allowing you to create rich, interactive websites.
To start, let’s write a simple program that prints “Hello, World!” to the console.
<script>
console.log("Hello, World!");
</script>
Open your browser’s console to see the message. You can open the console by pressing F12 or Ctrl+Shift+J on most browsers.
Add the following code to your HTML file to display "Hello, World!" in the console:
<!DOCTYPE html>
<html>
<head>
<title>Hello World Example</title>
</head>
<body>
<script>
console.log("Hello, World!");
</script>
</body>
</html>
Save the file and open it in a browser. Check the console to see the message!
Answers: JavaScript adds interactivity; HTML, CSS, and JavaScript; F12 or Ctrl+Shift+J.