#Day 59/100 – What Happens Before Your Page Loads in JavaScript? Today I learned something surprising… JavaScript actually runs before the page fully loads on the screen. I always thought: Browser loads HTML → then CSS → then JavaScript. But reality is more interesting 👇 When the browser reads HTML, it doesn’t wait till the end. The moment it finds a <script> tag, it stops building the page and executes JavaScript immediately. This process is called parsing + blocking execution. So the flow becomes: HTML reading ➝ sees JS ➝ pause ➝ run JS ➝ continue building page That’s why sometimes: • Page looks blank for a second • Buttons don’t appear instantly • UI feels slow Because JS is literally interrupting the page construction. 💡 Important concepts I understood today: 🔹 Rendering – browser drawing UI 🔹 Parsing – browser reading HTML line by line 🔹 Blocking scripts – JS pauses page creation 🔹 defer & async – solutions to avoid blocking Big realization: Bad script placement can make a fast website feel slow. Good script placement can make the same website feel instant. Small detail… huge impact. Every day I learn — frontend is not just coding, it’s understanding how the browser thinks 🧠 #100DaysOfCode #JavaScript #FrontendDevelopment #WebDevelopment #LearningInPublic #CodingJourney
JavaScript Runs Before Page Load: Understanding Browser Flow
More Relevant Posts
-
"I created the element… so why isn't it on my screen?" 🧐 If you are someone who is just stepping into the world of JavaScript — this post is for you. And if you have never written a single line of code in your life, don't scroll away. I've got you too. You write your code, you define your element… and the browser just stares back at you. Blank. Here's the "Aha!" moment that changed how I used to think about the DOM in my starting phase if you are also the one ..here is a short read for you : When you use document.createElement("h3"), JavaScript creates that element in memory — not on the page. Not a programmer? Here's all you need to know: Imagine you're a chef. You just cooked a beautiful dish in the kitchen. It's ready, it smells amazing — but you haven't served it to the table yet. Your guests have no idea it exists. createElement is you cooking. append is you walking out and placing it in front of them. No serving = no dish on the table. Simple as that. 🍽️ Now for the code side of things: 🏗️ Step 1: The Workshop JS- const heading = document.createElement("h3"); heading.textContent = "Hello, World! 👋"; You just built a sign in your workshop. It exists. You can touch it, style it, write on it. But it's still sitting in your workshop — the world hasn't seen it yet. 🖼️ Step 2: The Gallery JS- document.body.append(heading); This is you driving to the gallery and hanging that sign on the wall. Now the world can see it. The real power? You can build 100 elements behind the scenes, style them, fill them with data, and only show them to the user when they're perfectly ready. That's not a bug — that's JavaScript giving you total control. 💡 Nothing shows up until you append. You're the architect. append() is your moment to open the doors. Don't let a blank screen discourage you. You're not doing it wrong — you just haven't hung your sign yet. 🔨 #javascript #codenewbie #dommanipulation
To view or add a comment, sign in
-
-
🚀 Learning in Public – JavaScript DOM Today in class we explored the Document Object Model (DOM) in JavaScript. The DOM represents an HTML document as a tree structure where each element becomes an object that JavaScript can interact with. Through DOM manipulation we can make web pages dynamic and interactive. 💡 Things I learned today: • How to select elements using "document.getElementById()" "document.querySelector()" • How to modify content using "innerHTML" and "textContent" • How to change styles dynamically with JavaScript • Handling user actions using "addEventListener()" Example: document.querySelector("button").addEventListener("click", () => { document.getElementById("title").textContent = "Button Clicked!"; }); This simple concept is the foundation behind many interactive web features like forms, to-do lists, and dynamic UI updates. Small steps every day toward becoming a better developer. 💻 thanks Suraj Kumar Jha for the amazing lecture #LearnInPublic #JavaScript #WebDevelopment #DOM #chaicode
To view or add a comment, sign in
-
-
Today I attended a fantastic DOU Live webinar by Сергій Бабіч on the topic: “JavaScript (almost) not needed: how to build functional UI with just HTML & CSS” 🚀 It was eye-opening to see how modern HTML and CSS features let us significantly reduce (or even eliminate) JavaScript and third-party libraries, resulting in simpler, cleaner, more performant code. We covered pure no-JS implementations of: - toggling a list between list and grid layouts with responsive design changes - a simple modal dialog - custom tooltips, tabs, and select-like components All without a single line of JavaScript! What impressed me the most was watching an experienced developer’s approach to project structure and mastering the cascade. Several techniques were either new to me or ones I’d only heard about: - @container queries - @layer for better cascade control - @starting-style - native <dialog> element - the powerful :has() pseudo-class - and a few more gems! I’m already planning to apply several of these ideas to my current landing page project - both to solidify the knowledge hands-on and to make the code cleaner and more maintainable. Who else is experimenting with “CSS-only” interactivity in 2026? What are your favorite modern CSS tricks that replace JS? 😄 Huge thanks to Сергій Бабіч for the inspiring session! #Frontend #CSS #HTML #NoJavaScript #WebDevelopment #LearningInPublic
To view or add a comment, sign in
-
Building a Simple BMI Calculator with HTML, CSS, and JavaScript By Devendra Kumar Dixit Why I Built This I wanted a small, practical front-end project that I could complete without overengineering it. The focus was on clarity: simple logic, readable code, and a UI that doesn’t get in the way. I intentionally avoided frameworks to practice core HTML, CSS, and JavaScript fundamentals.... https://lnkd.in/ekQwYy-F
To view or add a comment, sign in
-
Just Built a Color Palette Generator using HTML, CSS & JavaScript! Today I created a simple Color Palette Generator where users can generate random color palettes with just one click. It’s a small project but a great way to practice JavaScript logic and DOM manipulation. ✨ What I practiced in this project: • Generating random HEX colors • Updating UI dynamically using JavaScript • DOM manipulation • Clean and responsive layout with HTML & CSS live link : https://lnkd.in/gf_k8zgh #JavaScript #WebDevelopment #FrontendDeveloper #HTML #CSS #CodingJourney #BuildInPublic
To view or add a comment, sign in
-
-
DOM Manipulation in JavaScript — How it Works 📄 HTML This defines the structure of the webpage (buttons, text, images). 🌳 DOM The browser converts HTML into the Document Object Model — a tree-like structure that JavaScript can access. ⚙️ JavaScript (JS) JavaScript interacts with the DOM to control elements on the page. 🎯 Select Element JavaScript selects a specific element like a button, text, or image. 👆 User Event A user action happens (click, input, hover). 🔄 Update Page JavaScript updates the DOM, and the browser reflects the change instantly without reloading the page. This entire flow is called DOM manipulation — and it’s what makes websites interactive 🚀 #JavaScript #WebDevelopment #ProgrammingBasics
To view or add a comment, sign in
-
-
Day 18🚀 #𝟯𝟬𝗗𝗮𝘆𝘀𝗼𝗳𝗰𝗼𝗱𝗶𝗻𝗴 HTML, CSS, BOOTSTRAP, JAVASCRIPT👨🏼💻 🚀 Built a Custom Range Counter using JavaScript...... I recently worked on a small project where I created a Custom Range Counter that dynamically counts numbers between a user-defined range. 💡 What the project does: The user enters a From value and To value, and when the Start button is clicked, the counter automatically counts up or down every second until it reaches the target number. 🔧 Key Concepts Used: ✨ DOM Manipulation using document.getElementById() ✨ Handling button click events with onclick ✨ Validating user input before processing ✨ Converting string inputs to numbers using parseInt() ✨ Using setInterval() to update the counter every second ✨ Implementing conditional logic to count increment or decrement ✨ Stopping the timer with clearInterval() when the target is reached ✨ Dynamically updating the webpage using textContent 📚 This project helped me strengthen my understanding of JavaScript timers, DOM manipulation, and user interaction in web development. Excited to keep building more interactive web projects! 💻 #NxtWave #CCBP #Day18 #HTML #CSS #bootstrap #FrontendDevelopment #MiniProject #30DaysOfCode #MERN #JS #JavaScript #WebDevelopment #CodingJourney #LearnToCode #DeveloperLife
To view or add a comment, sign in
-
Linking JS file Sounds small… but it’s VERY important. 🔥 Without linking JS properly, your website is just a static page. 💡 What is a JS File? A JavaScript file (script.js) contains code that makes your website: ✅ Interactive ✅ Dynamic ✅ Responsive to user actions For example: - Button click events - Form validation - Show/Hide content - API calls 🛠 How to Link JavaScript File? There are 2 common ways: ✅ 1️⃣ Inside <head> <head> <script src="script.js"></script> </head> Problem ❌ JS loads before HTML → can cause errors. ✅ 2️⃣ Before Closing </body> <body> <script src="script.js"></script> </body> Why this is better? ✔ HTML loads first ✔ Then JavaScript runs ✔ Faster page experience 🎯 What I Understood Today Linking JS file is simple but powerful. One small line connects your entire logic to the UI. #WebDevelopment #JavaScript #Programming #Coding #SoftwareDevelopment #Tech
To view or add a comment, sign in
-
-
#Day 60/100 – How JavaScript Powers Real Websites Behind the Scenes 🌐 When we open a website, everything looks simple. Click a button. Submit a form. Scroll. Like a post. But behind that smooth experience… JavaScript is doing A LOT. Today I realized something: JavaScript is not just “adding buttons.” It’s managing the entire interaction layer of the web. Here’s what it actually does behind the scenes: 🔹 Updates content without reloading the page (like Instagram or LinkedIn feed) 🔹 Validates forms before sending data 🔹 Handles API calls and displays live data 🔹 Manages state (what you clicked, typed, selected) 🔹 Controls animations and dynamic UI changes When you add an item to cart — JavaScript updates the UI instantly. When you see notifications — JavaScript fetched that data silently. When a website feels “fast” — That’s JavaScript working smartly. Big realization today 💡 Good JavaScript is invisible. You don’t notice it when it works — You only notice it when it breaks. Frontend is not just design. It’s logic, timing, state, and user experience. 60 days in… and I finally see how powerful this language really is. #100DaysOfCode #JavaScript #WebDevelopment #Frontend #LearningInPublic #CodingJourney
To view or add a comment, sign in
-
-
🔍 Understanding Scope & Lexical Environment in JavaScript If you’ve ever wondered how JavaScript knows where a variable lives, the answer lies in scope and the lexical environment. 📌 Scope Scope determines where variables are accessible in your code. let globalVar = "I am global"; function outer() { let outerVar = "I am outer"; function inner() { let innerVar = "I am inner"; console.log(globalVar); // Accessible console.log(outerVar); // Accessible console.log(innerVar); // Accessible } inner(); } outer(); Each function creates its own scope, but inner functions can access variables from outer scopes. 📌 Lexical Environment A lexical environment is created whenever JavaScript executes code. It consists of: • Local variables • References to its outer environment This is why JavaScript supports closures — functions remember where they were created. function counter() { let count = 0; return function() { count++; console.log(count); }; } const increment = counter(); increment(); // 1 increment(); // 2 Even after counter() finishes, the inner function remembers count. ⸻ 💡 Key Takeaway: • Scope → Where variables can be accessed • Lexical Environment → How JavaScript keeps track of those variables Understanding this is key to mastering closures, hoisting, and the execution context. #JavaScript #WebDevelopment #Frontend #Closures #Scope #CodingInterview
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development