Day 17 of me reading random and basic but important coding facts.... Today I read about Arrays in JS and turns out, they aren't just simple lists..... Push/Pop vs. Shift/Unshift Push /Pop is very fast as it just adds/removes from the end.... while Shift/Unshift is very slow.....becoz when we remove the first element, the engine has to physically move every single other element to the left to fix the indices....... and another very very interesting fact is that the length property isn't read-only.............. If we set arr.length = 0, it instantly clears the array. If we manually decrease the length (e.g., arr.length = 2), it truncates the data from the end.....and there is no coming back....... So, use them wisely..... Keep Learning!!!!! #javascript #coding #webdevelopment #learning #frontendDev
JS Arrays: Push/Pop vs Shift/Unshift Performance
More Relevant Posts
-
Coming from JavaScript, polymorphism always felt natural — the same function behaving differently depending on the object. It’s one of the reasons modern web apps feel smooth and intuitive. Exploring it in Python has reinforced why this concept matters. Polymorphism lets us design around behavior, not rigid structures. Same interface, different outcomes — cleaner code for developers and consistent experiences for users. Think of a render() method handling buttons, modals, or cards. The UI stays predictable while the logic stays flexible. It’s one of those quiet tools that helps software evolve without breaking — and that’s exactly what clients value. Do you use polymorphism often?
To view or add a comment, sign in
-
-
Day 22 of me reading random and basic but important coding facts. Today, I read about the "Three Dots" (...) in JavaScript. Think of a collection (like an Array) as a 𝗕𝗼𝘅. 1. Rest Parameters (...) = Packing the Box Imagine we have loose items on a table and we just want to stuff them into a box. It happens Inside function 𝘥𝘦𝘧𝘪𝘯𝘪𝘵𝘪𝘰𝘯𝘴. It gathers individual arguments and "rests" them into a single array. // We "pack" 2, 3, 4, 5 into the 'rest' box function sum(first, ...rest) { // first is 1 // rest is [2, 3, 4, 5] } 2. Spread Syntax (...) = Unpacking the Box Imagine having a full box and we want to dump the contents onto the floor. It happens inside function calls or when creating new arrays/objects. It takes an array and spreads the items out individually. const box = [1, 2, 3]; // We "unpack" the box to pass 1, 2, 3 individually Math.max(...box); #javascript #webdevelopment #coding #frontendDev
To view or add a comment, sign in
-
-
🚀 JavaScript Loops Explained | forEach vs for…of vs for…in Many developers get confused about which JavaScript loop to use and when. This visual guide clearly explains the difference between: ✅ forEach() – best for arrays ✅ for…of – perfect for iterables like arrays & strings ✅ for…in – ideal for looping through object keys Understanding these loops helps you write cleaner, more readable, and efficient JavaScript code. 💡 Pro Tip: Arrays ➝ forEach / for…of Objects ➝ for…in Save & share this with someone learning JavaScript 🔖 Nishant Pal #JavaScript #JavaScriptLoops #WebDevelopment #FrontendDevelopment #Coding #Programming #Developer #LearnJavaScript #JSBasics
To view or add a comment, sign in
-
-
Day 38/100 – Coding Challenge 🚀 REST APIs | Cheat Sheet 📘 Deep dive into GET Books API and how real-world filtering actually works. What I locked in today 👇 Query Parameters (?, &) — clean + powerful limit & offset for pagination (no more data overload) Search using search_q 🔍 Sorting results with order = ASC | DESC Difference between query params vs path params (important, don’t mix these up) Core REST principles: scalability, reliability, standard HTTP methods, JSON responses Example that finally clicked: http://localhost:3000/books?offset=2&limit=3 REST isn’t just theory — it’s how real APIs stay fast, clean, and usable. One more day closer to backend confidence 💪 Consistency > Motivation. Let’s go. 🔥#100DaysOfCode #Day38 #RESTAPI #APIDevelopment #BackendDevelopment #WebDevelopment #JavaScript #NodeJS #ExpressJS #QueryParameters #Pagination #APIFiltering #FullStackDeveloper #CodingJourney #LearnByDoing #TechLearner #DeveloperLife 💻🚀
To view or add a comment, sign in
-
-
Recursion is just a conversation with the future. I used to think of recursion as a "fancier loop." I was wrong. I realized that when you call a function twice inside itself, you aren't just repeating code—you are creating a "Branching Factor." Each call pauses the parent and creates a new instance. If you do this in a loop, your execution stack explodes exponentially! While a loop moves horizontally through an array, recursion moves vertically. Every time sum calls itself, the computer "pauses" the current calculation and opens a new layer on the Call Stack. The logic breakdown: We ask for the value at index 0. We wait for the value of index 1... which waits for index 2... Once we hit the Base Case (the end of the array), the values start "bubbling up" back to the start. Key Lesson: Understanding the Call Stack is the difference between a working app and a "Stack Overflow." #JavaScript #Coding #WebDevelopment #DataStructures
To view or add a comment, sign in
-
-
The this keyword broke my brain for months. Then I learned one rule that changed everything. The value of this isn't about WHERE the function is written. It's about HOW it's called. ``` let obj = { name: "John", greet: function() { console.log(this.name); } }; obj.greet(); // "John" - called with obj reference let func = obj.greet; func(); // undefined - called without reference ``` Same function. Different this values. Because we called it differently. Arrow functions are the exception - they don't follow this rule. They inherit this from wherever they're physically written in your code (lexical scope). You can't change it with call/apply/bind. ``` let obj = { name: "John", arrow: () => { console.log(this); // window, NOT obj } }; ``` The arrow function looks at where it's written (global scope), not where it's called. My decision process now: 1. Arrow function? → Inherited from parent scope 2. Called with call/apply/bind? → Whatever you specified 3. Called as obj.method()? → The object before the dot 4. Regular function call? → undefined (strict) or window This mental model fixed 90% of my this confusion. Documented all the rules with examples: https://lnkd.in/ddwDFdKz Thanks to Akshay Saini 🚀 and Namaste JavaScript for making this finally make sense. This was the last topic in the Namaste JavaScript series by Akshay Saini 🚀 incredible learning journey! Really hoping for more videos ahead, they've helped tremendously in understanding JavaScript deeply. What's your biggest this confusion? Let me know if I missed anything - happy to improve it. #JavaScript #WebDev #Coding #100DaysOfCoding #LearningInPublic #NamasteJavascript
To view or add a comment, sign in
-
Stop writing finally blocks. JavaScript 2026 has a better way. We’ve all been there: a production crash because a file handle wasn't closed or a database connection leaked. Historically, we relied on verbose try...catch...finally blocks to manage this. But the upcoming ECMAScript update is changing the game with Explicit Resource Management. The new using keyword allows you to bind resources to a block scope. When the block ends, the resource cleans itself up. Automatically. I just published a detailed guide on Medium covering: 🔹 The new using syntax (vs const) 🔹 How to implement Symbol.dispose 🔹 Handling async cleanup with await using 🔹 Why this creates a "pit of success" for developers #SoftwareEngineering #JavaScript #CleanCode #WebDevelopment #ES2026 Read the full breakdown here:
To view or add a comment, sign in
-
Most beginners struggle with JavaScript not because of syntax, but because of logic. Here’s a simple mindset shift that helped me: Always break the problem into small steps before writing code. Example: Checking if a number is even or odd Instead of jumping into code, think: What input do I have? → a number What condition decides the result? → remainder when divided by 2 What output do I want? → even or odd code: const num = 7; console.log(num % 2 === 0 ? "Even" : "Odd"); Key Logic Rule in JavaScript If you can explain your solution in plain English, you can code it. Strong logic beats memorizing 100 methods. If you’re improving your JavaScript logic daily, you’re already ahead of most developers. #JavaScript #JavaScriptLogic #ProgrammingTips #WebDevelopment #Coding #LearnToCode #FrontendDevelopment #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
Major Update: I just gave VS Code a "Context Brain". We’ve all been there: You switch from a React project to a Python backend, and suddenly you have to context-switch your brain too. "What was that build command again?" "Did I install react-router or react-router-dom?" Manually typing dependencies and remembering framework-specific commands is a productivity killer. That's why I built DotCommand v1.4.0. It’s no longer just a command runner. It’s an Intelligent Development Assistant that understands your project structure. ✨ What's New in v1.4.0? 🧠 Smart Context Engine: It scans your workspace (reading package.json, Dockerfile, go.mod, etc.) and adapts its suggestions instantly. 📦 Dynamic Dependency Parsing: As shown in the video, it reads your dependencies in real-time and feeds them into commands. No more typos. ⚡ Native Integration: Works seamlessly with VS Code's native UI—no distracting popups. I built this to solve the "command fatigue" I face daily. It’s open-source, lightweight, and privacy-focused. I’d love for you to try it and let me know your thoughts! 👇 Download links are in the first comment. #vscode #opensource #webdevelopment #productivity #javascript #typescript #softwareengineering #dotsuite #DotCommand #FreeRave
To view or add a comment, sign in
-
🚀 Day 876 of #900DaysOfCode ✨ The 8 Most Useful Math Object Methods in JavaScript The JavaScript Math object is packed with powerful utilities — and knowing the right ones can save you time, simplify your logic, and make your code cleaner and smarter. In today’s post, I’ve highlighted 8 extremely useful Math methods that every JavaScript developer should know. They’re explained in a simple, practical, and easy-to-remember way so you can apply them instantly in your projects. If you want to level up your JS fundamentals, this post is a must-read. 👇 Which Math method do you use the most? Share in the comments! #Day876 #learningoftheday #900daysofcodingchallenge #FrontendDevelopment #WebDevelopment #JavaScript #React #CodingCommunity #MathObject
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