Today’s focus: Loops in JavaScript : Loops allow us to execute a block of code multiple times — making our programs efficient and reducing repetition. Here are some examples I practiced today // For loop for (let i = 0; i < cars.length; i++) { text += cars[i] + "<br>"; } // While loop while (i < 10) { text += "The number is " + i; i++; } Use for loops when you know the number of iterations. Use while loops when looping depends on a condition. Always make sure your loop has a stopping condition to avoid infinite loops Every day, I’m understanding how small logic blocks combine to form powerful programs. Excited for Day 6 tomorrow! #JavaScript #Loops #CodingJourney #WebDevelopment #100DaysOfCode #FrontendDevelopment #LearnToCode
"Practiced JavaScript loops: for and while"
More Relevant Posts
-
🚀 I used to think JavaScript was just “interpreted”… Until I discovered how much magic happens before a single line runs. When you write something simple like let sum = 10 + 5, the JS engine doesn’t just read it; it compiles it. Yes, JavaScript is compiled before execution (just-in-time). ⚙️ Here’s what actually happens behind the scenes: 1️⃣ Tokenization – your code is broken into keywords, operators, and identifiers. 2️⃣ Parsing – those tokens form an Abstract Syntax Tree (AST) that maps out the structure of your program. 3️⃣ Interpretation – the AST is turned into bytecode. 4️⃣ JIT Compilation – engines like V8’s TurboFan optimize bytecode into fast machine code. 5️⃣ Garbage Collection – memory is automatically cleaned up when no longer needed. All of this happens in milliseconds ⚡ Every single time your JS runs. I broke down each step in detail in my new Medium article 👇 👉 https://lnkd.in/dM7yNH6f #JavaScript #WebDevelopment #Programming #NodeJS #Frontend #V8 #SoftwareEngineering
To view or add a comment, sign in
-
-
🧮 Day 42 | In-Built Objects in JavaScript Explored Math and Date objects in JavaScript today — the foundation of many logical operations. 🧠 Learned about: • Math constants & methods (PI, round, random, pow, sqrt) • Date creation, formatting & manipulation • Time control using get and set methods ✨ Key Takeaway: JS comes packed with powerful tools — we just need to know how to use them right! 🔗 GitHub: https://lnkd.in/dtdU9-zZ #WebDevelopment #JavaScript #CodingJourney #Frontend
To view or add a comment, sign in
-
-
If you’re still debugging JavaScript with console.log() everywhere, there’s a better way. Here are 5 tools that will make your debugging cleaner, faster, and more effective 👇 1️⃣ console.table() Turns arrays & objects into clean, readable tables. console.table(users) 2️⃣ console.group() Helps you organize logs logically. console.group("API Data") console.log(response) console.groupEnd() 3️⃣ Use the debugger; statement. It stops execution right in DevTools so you can inspect everything live. 4️⃣ Performance logs console.time("load") // run code console.timeEnd("load") Perfect for finding slow code sections. 5️⃣ Bonus tip: breakpoints > spam logs. Learn to pause at the right moment instead of flooding your console. console.log() got you here; but better tools will get you further. Follow for more modern dev tips 👇 #WebDevelopment #JavaScript #FrontendDevelopment #CodingTips #SoftwareEngineering #DevCommunity #Programming #Debugging #Developers #ReactJS #CodeBetter #TechTips
To view or add a comment, sign in
-
-
JavaScript Closures Explained 💡 A closure is a powerful feature in JavaScript where an inner function retains access to variables from its outer function, even after the outer function has finished executing. This means the inner function "remembers" the environment it was created in. Closures enable data encapsulation, function factories, and help with keeping state in asynchronous code. Example: function outer() { let count = 0; return function inner() { count++; console.log(count); }; } const counter = outer(); counter(); // 1 counter(); // 2 counter(); // 3 Here, inner remembers the count variable even after outer is executed. This is what makes closures so useful! #JavaScript #Closure #WebDevelopment #JavaScriptClosures #Coding #Programming #LearnJavaScript #FrontendDevelopment #DevTips #JavaScriptTips #CodeNewbie
To view or add a comment, sign in
-
💡 LeetCode #268 — Missing Number (JavaScript Edition) This problem looks simple, but it’s one of those logic-building gems that teach you how to think mathematically in code. You’re given an array containing numbers from 0 to n, but one number is missing. The task? Find that number efficiently. Here’s the beauty — instead of using loops or sorting tricks, we can use a mathematical formula: 🔹 The sum of first n natural numbers = (n * (n + 1)) / 2 🔹 Subtract the actual sum of the array from this total — and the result is the missing number! function missingNumber(arr) { let n = arr.length; let sum = 0; let total = (n * (n + 1)) / 2; for (let i = 0; i < n; i++) { sum += arr[i]; } return total - sum; } console.log(missingNumber([0, 4, 2, 1])); 🧠 Fun fact: This approach runs in O(n) time and O(1) space — no extra array, no fancy methods, just pure logic. Problems like these make you realize how math and programming go hand in hand. Keep solving small logic-based problems — they sharpen both your problem-solving mindset and your coding confidence. 💪 #JavaScript #CodingJourney #FrontendDevelopment #DeveloperTips #LearnByDoing
To view or add a comment, sign in
-
After covering State Machines fundamentals, here's part 2 on using XState state machine library. Just published a complete guide on XState - the powerful Redux alternative for complex application logic. What's covered: • React + TypeScript setup • Async operations without race conditions • Visual debugging tools • Real multi-step form example • When to use it (and when not to) Read it: https://lnkd.in/dzHKjgaf New to State Machines? Start with Part 1 (link in comments). #XState #React #JavaScript #WebDevelopment #StateManagement
To view or add a comment, sign in
-
Don’t underestimate the power of fundamentals, they’re the building blocks of everything we create. Today, I decided to slow down a bit. Instead of diving into frameworks or complex architectures, I revisited something simple: Objects and Classes in JavaScript. It’s easy to get caught up chasing new tools, libraries, and technologies. But every now and then, going back to the basics reminds you how much strength lies in understanding why things work the way they do. When you truly master the fundamentals, you can build anything faster, cleaner, and with more confidence. What’s one fundamental concept you’ve recently revisited that made you appreciate how far you’ve come? #JavaScript #WebDevelopment #CodingFundamentals #SoftwareDevelopment #LearningNeverStops
To view or add a comment, sign in
-
-
Count the Number of Digits - JavaScript Logic Simplified 👉 Day 24 / Day 93👈 👉 Find how many digits a number has — without converting it to a string? 1️⃣ Handle 0 as a special case — it has 1 digit. 2️⃣ Use Math.abs() to support negative numbers. 3️⃣ Repeatedly divide the number by 10 until it becomes 0, increasing the counter each time. 💡 Example: 👉 23453 → 2345 → 234 → 23 → 2 → 0 ✅ Total digits = 5 #JavaScript #CodingTips #WebDevelopment #FrontendDeveloper #LearnToCode #ProgrammingLogic #CleanCode #ProblemSolving #100DaysOfCode #TechCommunity #CodeNewbie #Algorithms
To view or add a comment, sign in
-
-
what is V8 engine architecture in node.js? The V8 engine is a high-performance, open-source JavaScript and WebAssembly engine developed by Google. It is a core component of Node.js, responsible for executing JavaScript code outside of a web browser environment. The architecture of the V8 engine in Node.js can be understood through its key components and their roles in processing JavaScript: Parser: V8 first parses the JavaScript code, converting it into an Abstract Syntax Tree (AST). The AST is a tree-like representation of the code's structure, making it easier for the engine to understand and process. During parsing, V8 also performs syntax checking to ensure the code adheres to JavaScript rules. Ignition Interpreter: The AST is then fed to the Ignition interpreter, which converts the AST into bytecode. Ignition is a fast and efficient interpreter that executes the bytecode directly. It also collects profiling data about the code's execution, identifying "hot" code paths (code that is frequently executed). TurboFan Compiler: When Ignition identifies "hot" code, it sends this bytecode to the TurboFan compiler. TurboFan is an optimizing Just-In-Time (JIT) compiler. It takes the bytecode and, using the profiling data from Ignition, compiles it into highly optimized machine code specific to the underlying hardware. This optimization includes techniques like inline caching and hidden class optimization to improve performance. #sudheervelpala #frontend #javascript #task
To view or add a comment, sign in
-
-
🧱Objects — The Foundation of Everything in JavaScript 🗓️ This week, I focused on JavaScript Objects — and honestly, it changed how I see the language. From arrays to functions, almost everything in JS is built on objects. 💡Learning about prototypes, object methods, and inheritance made me realize how JavaScript manages structure without strict classes. “In JavaScript, objects don’t just hold data — they define behavior.” Once you get comfortable with the prototype chain, JS starts to feel less confusing and more elegant. #JavaScript #OOP #Programming #WebDevelopment #Frontend #CodingJourney #Developers
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