Skip to content

Day 1: What is JavaScript & The Console

Understand where JavaScript runs (browser engines like V8 and Node.js), connect a script to HTML, and execute code using the browser console.

JavaScript is an interpreted, high-level, multi-paradigm programming language. Initially created for web browsers, it now runs on servers via runtime environments like Node.js.

Always link scripts right before the closing </body> tag or use the defer attribute in the <head>:

<!-- In index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>JS Fundamentals</title>
</head>
<body>
<h1>JavaScript in Action</h1>
<script src="script.js"></script>
</body>
</html>

In script.js:

console.log('Hello, JavaScript!');
console.info('Helpful information');
console.warn('This is a warning');
console.error('This is an error message');

Open Chrome DevTools (F12 or Ctrl + Shift + I) and view the Console tab.

  1. Create index.html and script.js in a new folder and open with Live Server.
  2. Log mathematical expressions like console.log(25 * 4) and string combinations.
  3. Open Node.js in your terminal by typing node and evaluate basic expressions.