I spent hours stuck on a “simple” problem… sorting an array. No tutorial. No copy-paste. Just confusion, frustration, and trial & error. At first, nothing made sense: * Why isn’t my logic working? * Why do I need multiple loops? * Why does swapping break everything? But instead of escaping the discomfort… I stayed. I wrote it. Broke it. Rewrote it. Questioned everything. And then it clicked. I built my own custom sorting method (Bubble Sort) from scratch in JavaScript — not by memorizing, but by understanding. Biggest lesson from this: 👉 Real growth happens when you **sit with confusion instead of avoiding it 👉 Patience > Talent 👉 Struggle is not a sign of failure — it's the path to clarity Also learned: * Sorting is NOT about picking values, it's about **comparing & swapping repeatedly** * One pass is never enough — algorithms evolve step by step * Understanding beats memorization every single time Sharing my final implementation below👇 Course Instructor: Rohit Negi | Youtube Channel: CoderArmy #JavaScript #codiing #WebDevelopment #LearningInPublic #ProblemSolving #fullstackdevelopment
Building Custom Sorting Method in JavaScript from Scratch
More Relevant Posts
-
Everyone says “learn to code”… But no one talks about how confusing it gets. One day you're learning HTML. Next day: JavaScript. Then suddenly: Frameworks, libraries, tools… everything at once. It’s overwhelming. I’ve realized something though: Confusion isn’t a sign you’re failing. It’s a sign you’re learning. Now instead of trying to understand everything… I focus on: • One concept at a time • Practicing it properly • Moving step by step Because clarity doesn’t come from rushing. It comes from consistency. If you're feeling lost in tech right now… You’re probably on the right path.
To view or add a comment, sign in
-
🚀 50 Weeks, 50 Projects – Week 6 Complete To push my development skills beyond tutorials, I'm continuing my 50 Weeks, 50 Projects challenge, where I build and ship one project every week. 🛠 Week 6 – API Lens: AI-Powered JSON Explorer Ever stared at a raw API response and had no idea what half the fields meant? That's exactly why I built this. Tech Stack: HTML · CSS · Vanilla JS · OpenRouter API (Mistral-7B, free tier) Design Style: Warm, human-first UI — cream tones, serif typography (Fraunces), and a layout that feels more like a notebook than a dev tool. Built specifically to be approachable for beginners. Functionality: 📋 Paste raw JSON or fetch any public API URL directly 🤖 AI explains every field in plain English — no docs needed 🌳 Interactive collapsible field tree with color-coded types ⏱ Unix timestamps decoded to human-readable dates automatically 🛡 Auto-detects response type: JWT, paginated list, error, REST 📋 One-click copy for JS, Python & cURL code snippets ⚡ 3-layer CORS proxy fallback — works with almost any public API Suggestions: I'd love feedback from the community! What other API patterns should I detect? Any features that would make this more useful in your daily workflow? Live URL : https://lnkd.in/dBcejh34 #50WeeksChallenge #BuildInPublic #WebDev #JavaScript #API #OpenSource #100DaysOfCode
To view or add a comment, sign in
-
-
7 days ago I made a decision to stop being comfortable and start being consistent. Today I am finally showing up publicly for the first time. Today I read about Thorndike's cat experiment in Atomic Habits. He placed cats in a puzzle box and tracked how long they took to escape. First attempt: 160 seconds. After 20 trials: 6 seconds. No manual. No preparation. Just repeated attempts until the action became automatic. This morning I caught myself saying "I need to revise JavaScript before building anything." I ignored that thought and just opened VS Code instead. Got stuck. Googled it. Fixed it. Built a working Budget Tracker in vanilla JavaScript with DOM manipulation, event listeners, input validation and transaction history. The struggle was the learning. Also went deep into JavaScript type coercion today. Why typeof(5 * "JavaScript") returns NaN, how truthy and falsy values actually work, and why undefined, null, NaN and 0 all behave differently. These are the things that separate someone who writes JavaScript from someone who understands it. Solved 4 DSA problems alongside. Atomic Habits says habits free up mental space for harder problems. Every concept I understand deeply today is one less thing my brain has to think about tomorrow. Day 1 of showing up publicly. Let's see where Day 30 looks like. #100DaysOfCode #JavaScript #DSA #LearningInPublic #SoftwareEngineering
To view or add a comment, sign in
-
𝗚𝗼𝗼𝗱 𝗰𝗼𝗱𝗲 𝗱𝗼𝗲𝘀𝗻’𝘁 𝗷𝘂𝘀𝘁 𝘄𝗼𝗿𝗸 𝗶𝘁 𝗰𝗼𝗺𝗺𝘂𝗻𝗶𝗰𝗮𝘁𝗲𝘀. 𝗧𝗵𝗮𝘁’𝘀 𝘄𝗵𝗲𝗿𝗲 𝘀𝗲𝗺𝗮𝗻𝘁𝗶𝗰 𝗺𝗮𝗿𝗸𝘂𝗽 𝗰𝗼𝗺𝗲𝘀 𝗶𝗻. Most beginners focus on making a website look good. But great developers focus on making it make sense. Semantic markup is about writing code that actually explains your content, not just displaying it. It helps search engines understand you better and makes your site accessible to everyone. Because in the end, clean, meaningful code isn’t just for machines; it’s for people too. #WebDevelopment #HTML #FrontendDevelopment #CodingTips #LearnToCode #WebDesign #SEOtips #DeveloperLife #ProgrammingBasics #TechEducation #CodeBetter #UXDesign #DigitalSkills #CodingJourney
To view or add a comment, sign in
-
-
👉 Lexical Scope A function can access variables from its parent scope — but not the other way around. In simple terms: Inner functions can use variables from outer functions Outer functions cannot access variables defined inside inner functions For example, a nested function can access variables like a and b from its parent scopes, but variables defined inside it (like c) are not available outside. This is why code inside a function may work perfectly, but trying to access the same variables outside results in a “not defined” error. Understanding lexical scope is important because it helps you write predictable code, avoid scope-related bugs, and better structure your functions. That’s why: ✔ Inside functions → everything works ❌ Outside → “not defined” errors Simple concept… but super important for writing clean and bug-free code. Still learning, step by step 🚀 #JavaScript #WebDevelopment #Frontend #Coding #LearnInPublic
To view or add a comment, sign in
-
-
I've read the definition of closures probably 10 times. "A function bundled with its lexical scope." Made sense on paper. But I never truly got it until I came across the backpack analogy. Here's how it actually works: When a function is returned from a higher order function, it doesn't leave empty handed. It carries a backpack. That backpack is attached via a hidden [[scope]] link and contains persistent memory of the variables from its outer environment, even after that outer function has finished executing. The data lives on. Attached to the function. Quietly. And once I understood that, everything clicked: → once() runs a function exactly one time, then remembers it already ran → memoize() caches previous results so you never compute the same thing twice → iterators maintain position in a sequence across multiple calls → module pattern keeps variables private, exposes only what you choose → async programming lets callbacks remember the context they were created in All of these are closures in action. I've been writing JavaScript for 3 years. Going back to the fundamentals has been humbling and genuinely eye opening. If you've been skimming over closures, I'd recommend diving deep. It changes how you read code. #javascript #webdevelopment #softwareengineering #frontenddevelopment #continuouslearning
To view or add a comment, sign in
-
-
🚀 JavaScript Essentials — closures, Math operators & recursion, but make it real Step by step, I’m building stronger JavaScript fundamentals through practice. In this homework, I worked on topics that are simple in theory, but much more interesting when you actually implement them yourself: ● Closures & state management ● Recursive functions ● Math methods and function binding with apply() / bind() 🛠 What I built in practice: ● counter() — a closure-based counter that remembers its state and can restart from any given number ● counterFactory() — a small counter object with .value(), .increment(), and .decrement() built with closures ● myPow(a, b, myPrint) — a recursive power function with a callback for formatted output ● myMax(arr) — finding the maximum value in an array using Math.max.apply() ● myMul(a, b) + myDouble() / myTriple() — reusing logic with bind() This task helped me better understand how JavaScript works with scope, closures, recursion, and reusable functional patterns. What I like about this kind of practice is that it turns abstract concepts into something tangible. Not just “I read it” — but “I built it, tested it, and now I actually get it.” 🔗 GitHub: https://lnkd.in/dHTBr-h3 Always learning. Always building. One function at a time 💻 "Coding like Zagreus: dying, retrying, and somehow making progress. ⚔️💻" #JavaScript #LearningByDoing #Closures #Recursion #MathOperators #FunctionalProgramming #Frontend #CodingJourney #WebDevelopment
To view or add a comment, sign in
-
-
Day 01: Precision Matters 🔢 Kicking off my coding journey by tackling a classic: The Plus Minus Challenge. The Problem: Given an array of integers, calculate the ratios of positive numbers, negative numbers, and zeros. The catch? The output must be precise to six decimal places. The Solution: It’s all about iteration and formatting. By looping through the array and categorizing each element, we can determine the counts. The key to meeting the precision requirement in JavaScript is using the .toFixed(6) method. javascript function plusMinus(arr) { let n = arr.length; let positive = 0, negative = 0, zero = 0; for(let val of arr) { if(val > 0) positive++; else if(val < 0) negative++; else zero++; } console.log((positive/n).toFixed(6)); console.log((negative/n).toFixed(6)); console.log((zero/n).toFixed(6)); } plusMinus(arr); Key Takeaway: Even simple logic requires attention to detail—especially when it comes to floating-point precision! #CodingChallenge #JavaScript #ProblemSolving #100DaysOfCode #DataStructures
To view or add a comment, sign in
-
Can you pass parameters in a function call like this — (1)(2)(3)? In a normal function, we pass multiple arguments at once: functionName(1, 2, 3); But how can we pass parameters in separate parentheses? That concept is called currying. In a normal function, we accept multiple arguments and perform an operation. For example: function multiply(a, b, c) { return a * b * c; } multiply(1, 2, 3); // 6 Here, we must pass all arguments together. Otherwise, the function won’t work as expected. In currying, we break this into multiple functions, where each function takes only one argument: const multiply = a => b => c => a * b * c; multiply(1)(2)(3); // 6 Each function returns another function until all arguments are received. The real advantage of currying is reusability and flexibility: const double = multiply(2); double(3)(4); // 24 Here, we reuse part of the function by fixing one argument. So, currying is not about reducing code — it’s about creating more flexible and reusable functions when needed. #JavaScript #WebDevelopment #FrontendDevelopment #Programming #Coding #Currying #FunctionalProgramming #Closures #JavaScriptConcepts #JSBasics
To view or add a comment, sign in
-
-
🚀 Debouncing in JavaScript Ever wondered why search bars don’t hit the API on every keystroke? 🤔 Here’s the trick developers use 👇 🧠 What is Debouncing? 👉 It delays the execution of a function 👉 Until a certain time has passed after the last event ⚡ Without Debounce: ❌ Every keystroke → API call 😵 Too many requests 🐌 Poor performance ✅ With Debounce: 👉 Wait for the user to stop typing 👉 Then call API once 🚀 Smooth & optimized 💡 Real-life use cases: ✔ Search inputs (autocomplete) ✔ Window resize / scroll events ✔ Button clicks 🔥 Key Understanding: 👉 Rapid events are grouped into one 👉 Improves performance & reduces API load 💡 One line to remember: 👉 “Debounce waits for silence before running” 💬 Where have you used debounce? 📌 Save this for interviews (very important concept) #javascript #webdevelopment #frontend #coding #programming #javascriptdeveloper #learncoding #developers #100DaysOfCode
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