🚀 Day 8 :-JavaScript & DSA Fundamentals 🌳 Understanding the Prototype Chain Root level: Object.prototype Then: Array.prototype, Function.prototype, String.prototype Learning how inheritance works using: Object.create(obj1) This helped me truly understand prototype-based inheritance in JavaScript. ⚙️ Mastering Functions in Different Ways Function declarations Function expressions Arrow functions Parameters vs Arguments Spread vs Rest operators Understanding how this behaves differently in arrow functions was a big insight. 🔁 Control Flow & Logic Building if / else / nested if for / while / do while switch statements Nested loops Variable scope (global, local, block) Why avoiding var prevents scope-related bugs 🧠 Deep DSA Practice I spent an entire day solving: Search in Rotated Sorted Array in complete day i create logic only above problem but i learn a lot from this problem to understanding about binary search in depth #JavaScript #DSA #WebDevelopment #LearningInPublic #ProblemSolving #FrontendDeveloper
Mastering JavaScript Fundamentals with Prototype Chain and DSA
More Relevant Posts
-
🎯 Key Learnings from Day 3 ✔ Iterating through arrays efficiently ✔ Using counters to track values ✔ Applying conditional checks inside loops ✔ Strengthening problem-solving fundamentals Small consistent steps in DSA build strong logic and better problem-solving skills. Looking forward to solving more problems tomorrow. #DSA #JavaScript #CodingJourney #ProblemSolving #100DaysOfCode #LearningInPublic
To view or add a comment, sign in
-
I thought JavaScript arrays worked like C arrays… I was wrong. ❌ I believed: 👉 Arrays are stored in contiguous memory 👉 Indexing is just base + offset 👉 Everything sits neatly in one block But JavaScript doesn’t work like that. Here’s the real mental model 👇 ✅ The variable (arr) lives in the STACK ✅ It stores a reference (not the actual array) ✅ The actual array lives in the HEAP ✅ The array stores: • metadata (like length) • pointer to elements storage Now the interesting part: 👉 Elements can be: * primitives (numbers, booleans) * references (strings, objects) 👉 Strings/objects are usually stored separately in memory 👉 Arrays can be dynamic, sparse, and optimized internally ⚠️ Most important: JavaScript arrays are NOT guaranteed to be contiguous in memory. That means: They are closer to dynamic objects than low-level arrays. 💡 Actual storage depends on the JS engine (like V8), which heavily optimizes things under the hood. I made a diagram to simplify this 👇 Course Instructor: Rohit Negi | Youtube Channel: Coder Army #JavaScript #webdevelopment #buildinpublic #learninginpublic #fullstackdevelopment.
To view or add a comment, sign in
-
-
🚀 LeetCode Problem Solved – Sort Characters by Frequency Today I solved the “Sort Characters By Frequency” problem on LeetCode. 🔎 Problem Statement: Given a string, sort its characters in decreasing order based on their frequency. 🧠 Key Learning: Instead of directly sorting the string (which isn’t possible since strings are immutable in JavaScript), I: ✔ Counted the frequency of each character using an object ✔ Extracted keys using Object.keys() ✔ Sorted them based on frequency (descending order) ✔ Rebuilt the final string using nested loops 💡 Concepts Used: HashMap / Object for frequency counting Custom sorting with comparator function String building using loops Time Complexity optimization thinking ✨ Example: Input: "tree" Output: "eert" This problem strengthened my understanding of: Frequency-based sorting Custom comparator logic Clean DSA implementation in JavaScript Consistency in solving DSA problems daily 🚀 #LeetCode #DSA #JavaScript #ProblemSolving #CodingJourney #FrontendDeveloper #100DaysOfCode
To view or add a comment, sign in
-
-
Solved the Flatten a Multilevel Doubly Linked List problem using a Depth-First Search (DFS) approach in JavaScript. Key idea: Traverse the list and whenever a node contains a child pointer, recursively flatten the child list and splice it into the main list while maintaining proper prev and next connections. This problem is a great exercise in pointer manipulation and recursion. It reinforces how important it is to carefully update references when working with linked data structures. Time complexity: O(n) Space complexity: O(d) where d is the recursion depth. #DataStructures #Algorithms #LinkedList #JavaScript #DSA #CodingPractice #LeetCode #ProblemSolving #SoftwareEngineering
To view or add a comment, sign in
-
-
We all think arithmetic operators work the same… But in JavaScript, they don’t always behave as expected 👀 "2" + 2 "2" - 2 "2" * 2 "2" / 2 👉 Output: "2" + 2 → "22" 😳 "2" - 2 → 0 🤯 "2" * 2 → 4 😲 "2" / 2 → 1 😮 👉 Why this happens? In JavaScript: ✔ "+" → can act as string concatenation ✔ "-", "*", "/" → force numeric conversion 👉 That’s why results change based on the operator This behavior is called type coercion ⚡ 👉 Looks simple… but can break expectations 😅 Follow for more simple dev concepts 🚀 #JavaScript #Developers #WebDevelopment #Coding #Relatable #Learning
To view or add a comment, sign in
-
-
🚨 𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁 𝗺𝗮𝘆 𝗿𝗲𝗺𝗼𝘃𝗲 𝘁𝗵𝗲 𝗻𝗲𝗲𝗱 𝗳𝗼𝗿 𝘁𝗿𝘆...𝗰𝗮𝘁𝗰𝗵. Yes, you read that right. A new TC39 Stage-1 proposal is exploring a completely different way to handle errors in JavaScript. And it looks something like this: 𝗰𝗼𝗻𝘀𝘁 𝗱𝗮𝘁𝗮 = 𝘁𝗿𝘆 𝗮𝘄𝗮𝗶𝘁 𝗳𝗲𝘁𝗰𝗵𝗗𝗮𝘁𝗮(); 𝗜𝗻𝘀𝘁𝗲𝗮𝗱 𝗼𝗳 𝘄𝗿𝗮𝗽𝗽𝗶𝗻𝗴 𝗲𝘃𝗲𝗿𝘆𝘁𝗵𝗶𝗻𝗴 𝗶𝗻 𝘁𝗵𝗶𝘀: 𝘁𝗿𝘆 { 𝗰𝗼𝗻𝘀𝘁 𝗱𝗮𝘁𝗮 = 𝗮𝘄𝗮𝗶𝘁 𝗳𝗲𝘁𝗰𝗵𝗗𝗮𝘁𝗮(); } 𝗰𝗮𝘁𝗰𝗵 (𝗲𝗿𝗿) { 𝗰𝗼𝗻𝘀𝗼𝗹𝗲.𝗲𝗿𝗿𝗼𝗿(𝗲𝗿𝗿); } The idea is inline error handling — inspired by languages like Go and Rust. Why this matters 👇 • Less nested code • Cleaner async logic • More readable error handling • Fewer complex promise chains 𝗔𝗻𝘆𝗼𝗻𝗲 𝘄𝗵𝗼 𝗵𝗮𝘀 𝗯𝘂𝗶𝗹𝘁 𝗮 𝗹𝗮𝗿𝗴𝗲 𝗡𝗼𝗱𝗲.𝗷𝘀 𝗯𝗮𝗰𝗸𝗲𝗻𝗱 𝗼𝗿 𝗳𝗿𝗼𝗻𝘁𝗲𝗻𝗱 𝘀𝘆𝘀𝘁𝗲𝗺 𝗸𝗻𝗼𝘄𝘀 𝗵𝗼𝘄 𝗺𝗲𝘀𝘀𝘆 𝗲𝗿𝗿𝗼𝗿 𝗵𝗮𝗻𝗱𝗹𝗶𝗻𝗴 𝗰𝗮𝗻 𝗯𝗲𝗰𝗼𝗺𝗲. 𝗧𝗵𝗶𝘀 𝗽𝗿𝗼𝗽𝗼𝘀𝗮𝗹 𝘁𝗿𝗶𝗲𝘀 𝘁𝗼 𝘀𝗶𝗺𝗽𝗹𝗶𝗳𝘆 𝘁𝗵𝗮𝘁 𝗽𝗮𝗶𝗻. But before we get too excited: ⚠️ It’s currently Stage 1 in the TC39 process. Meaning it’s very early and may change a lot — or may never ship. Still, it highlights something important: JavaScript is continuously evolving by learning from other languages. And if this idea moves forward, it could change how we write async code forever. Curious to hear from developers 👇 Would you replace try...catch with inline error handling? #javascript #nodejs #webdevelopment #softwareengineering #programming #developers #coding
To view or add a comment, sign in
-
-
🚀 Day 933 of #1000DaysOfCode ✨ Sorting Arrays in JavaScript — Different Types Explained Sorting isn’t always just about numbers in ascending order. In today’s post, I’ve covered sorting arrays in JavaScript for different data types — whether it’s numbers, strings, objects, or more complex structures. The goal is to help you understand how sorting behaves internally and how to customize it properly. If you’ve ever faced unexpected results while using `.sort()`, this post will help you gain clarity and control. 👇 What type of array do you find most challenging to sort? #Day933 #learningoftheday #1000daysofcodingchallenge #FrontendDevelopment #WebDevelopment #JavaScript #React #Next #CodingCommunity
To view or add a comment, sign in
-
𝗛𝗮𝘃𝗲 𝘆𝗼𝘂 𝗲𝘃𝗲𝗿 𝘀𝘁𝗼𝗽𝗽𝗲𝗱 𝗮𝗻𝗱 𝗮𝘀𝗸 𝘆𝗼𝘂𝗿𝘀𝗲𝗹𝗳 𝘄𝗵𝘆 𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁 𝗶𝘀 𝗽𝗮𝘀𝘀 𝗯𝘆 𝘃𝗮𝗹𝘂𝗲, 𝗮𝗻𝗱 𝗻𝗼𝘁 𝗽𝗮𝘀𝘀 𝗯𝘆 𝗥𝗲𝗳𝗲𝗿𝗲𝗻𝗰𝗲?🤔 You see... when a value is passed into a function in JS, the function receives a copy of that value, not ❌direct access to the original variable. This means a function cannot reassign the caller’s variable or take ownership of it. For primitive values like (numbers, strings, booleans...), the copied value is independent, so changes inside the function do not affect the original value. (e.g reassigning) For objects and arrays(non-primitives), the copied value happens to be a reference (memory address) to the same object. So, mutating the object inside the function affects the original object but reassigning the reference does not! 🚫 so... JavaScript always passes values, but for objects, the value being passed is a reference ✅✅. If you understand this, it will surely save you from debugging headaches 🧑💻🧑💻 . . . . . #JavaScript #CodingTips #WebDevelopment #Programming #LearnToCode #CodeNewbie #SoftwareEngineering #DevTips #TechCommunity
To view or add a comment, sign in
-
-
🚀 Just published a new video on my YouTube channel JDCodebase. Today I explained one of the most important DSA patterns for beginners — Frequency & Map Pattern. In this video, I break down the concept in very simple terms and show how it helps solve common problems like: • Counting elements • Detecting duplicates • Comparing arrays • Checking anagrams I also implement everything step by step using JavaScript in VS Code, so beginners can clearly understand how the logic works. This pattern is widely used in problems like Two Sum, Valid Anagram, Contains Duplicate, and Majority Element, so mastering it is very useful for coding interviews. If you're starting your DSA journey with JavaScript, this video will help you build strong problem-solving fundamentals. 🎥 Video link https://lnkd.in/gzh4HBvs #dsa #javascript #coding #datastructures #algorithms #jdcodebase
Frequency Pattern in DSA Explained | Map, Anagram, Duplicates | JavaScript | DSA Foundations
https://www.youtube.com/
To view or add a comment, sign in
-
Just solved the Binary Search problem in JavaScript. Binary Search is a great example of the Divide and Conquer approach. Instead of checking every element, the algorithm looks at the middle of a sorted array and eliminates half of the search space each step. Because the array is divided in half every time, the time complexity becomes O(log n), which makes it much faster than linear search O(n) for large datasets. Small problem, but a great reminder of how powerful algorithmic thinking can be. #JavaScript #Algorithms #BinarySearch #CodingPractice #LeetCode #SoftwareEngineering
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