JavaScript: First Steps
You've likely structured pages with HTML and styled them with CSS. Now, it's time to add behavior. Welcome to JavaScript, the programming language of the web.
The Script Tag
By default, a browser assumes a file contains HTML. To tell it we are switching to JavaScript, we use the <script> tag. Everything between the opening and closing tag will be interpreted as JavaScript instructions (statements).
Making Noise: alert()
One of the simplest ways to see JavaScript in action is by calling the built-in alert() function. When the browser executes this, it halts the rendering of the page and forces the user to interact with a dialog box. While useful for an absolute beginner test, it is heavily frowned upon in modern web development because it ruins the user experience.
The Developer's Voice: console.log()
So, how do developers test if their code is working without annoying the user? They use console.log(). This command sends text directly to the browser's Developer Tools Console. It's an essential debugging tool that you will use constantly throughout your career.
View Full Transcript+
This section contains the full detailed transcript of the video lessons. It covers the transition from declarative languages (HTML/CSS) to an imperative programming language (JS). It details how JavaScript engines inside browsers parse code line-by-line sequentially, and the historical context of the 'Hello World' tradition in programming.
