β Blogs
How Javascript runs in your browser.
You wrote your first line of JavaScript yesterday β but how does it actually work inside your browser?
Letβs uncover the magic behind the scenes! π
π What Happens When You Write JavaScript?
When you write JS like this:
console.log("Hello World");Hereβs what your browser does:
1. It reads the HTML file.
2. When it finds a tag, it sends that JS code to the JavaScript Engine
3. The engine translates your human-written code into something the computer can understand.
4. It runs that code immediately and shows the result (like printing in the console).
π§ Meet the JavaScript Engine
Every browser has a built-in engine:
Chrome β V8 Engine
Firefox β SpiderMonkey
Safari β JavaScriptCore
Edge β Chakra (legacy)
These engines are super powerful programs that convert and execute your JS.
πΌοΈ Where Can You Run JS?
1. In-browser console (DevTools β Console tab)
2. Inside <script> tags in HTML
3. Using separate .js files linked to your HTML
Example in HTML-:
<script>
alert("This is JavaScript running!");
</script>Or-:
<script src="script.js"></script>π§ Quick Tip
π Use alert("Hello!") and console.log("Testing"); to quickly check if your JS code is working.
π§ͺ Practice Challenge
Create a .html file and write:
<!DOCTYPE html>
<html>
<head><title>JS Test</title></head>
<body>
<h1>Check your console!</h1>
<script>
console.log("JavaScript is running inside the browser!");
</script>
</body>
</html>Open it in your browser and check the console tab.
π Sign-Off
Tomorrow, youβll write your first real JavaScript program β clean and properly structured.
You're not just learning code β you're learning how the web thinks. π
Want to work together?
Get answers and advice from people you want it from. Techsphere designers and developers will help you create awesome softwares based on your requirements.