🚀 Day 20/100 – Implementing a curry() Function in JavaScript Today I explored an advanced JavaScript concept: Currying. Currying transforms a function with multiple arguments into a sequence of functions, each taking a single argument. 🧠 Problem: Convert a function so that it can be called like: sum(1)(2)(3) // 6 ✅ Solution: function curry(fn) { return function curried(...args) { if (args.length >= fn.length) { return fn(...args); } else { return function (...nextArgs) { return curried(...args, ...nextArgs); }; } }; } function sum(a, b, c) { return a + b + c; } const curriedSum = curry(sum); console.log(curriedSum(1)(2)(3)); console.log(curriedSum(1, 2)(3)); console.log(curriedSum(1)(2, 3)); ✅ Output: 6 6 6 💡 Key Learnings: • Currying allows partial application of functions • Helps create reusable and flexible functions • Improves function composition • Common in functional programming 📌 Real World Usage: • Used in utility libraries like Lodash • Helps in writing cleaner React code • Useful in event handling and reusable logic Understanding currying improves how you think about functions and composition in JavaScript. I’m currently open to Frontend Developer opportunities (React / Next.js) and available for immediate joining. 📩 Email: bantykumar13365@gmail.com 📱 Mobile: 7417401815 If you're hiring or know someone who is, I’d love to connect. #OpenToWork #FrontendDeveloper #JavaScript #ReactJS #NextJS #ImmediateJoiner #100DaysOfCode
Currying in JavaScript: A Key Concept for Reusable Functions
More Relevant Posts
-
Recently, I interviewed for multiple Senior React.js & Tech Lead roles — and noticed a pattern. Most interviewers asked basic but frequently repeated questions that test your clarity of concepts + coding approach. Here are the Top 10 common questions I was asked 👇 1️⃣ Call, Apply, Bind → Difference + Polyfill implementation 2️⃣ Flatten an Array without Array.flat() 👉 Input: [1,2,3,[4,5,6,[7,8,[10,11]]],9] 👉 Output: [1,2,3,4,5,6,7,8,10,11,9] 3️⃣ Inline 5 divs in a row without flex/margin/padding (Hint: display: inline-block) 4️⃣ Find sum of numbers without a for loop (Hint: reduce() / recursion) 5️⃣ Deep Copy vs Shallow Copy — behavior & how to achieve it 6️⃣ Promise & Async/Await output puzzle 7️⃣ Find first repeating character (e.g., "success" → "c") 8️⃣ Stopwatch Implementation (Start, Stop, Reset + live timer) 9️⃣ Build a To-Do List (Vanilla JS/React) → optimize re-renders 🔟 Currying for Infinite Sum 👉 sum(10)(20)(30)() → 60 👉 sum(10)(20)(30)(40)(50)(60)() → 210 𝐠𝐞𝐭 𝐞𝐛𝐨𝐨𝐤 𝐰𝐢𝐭𝐡 (detailed 232 ques = 90+ frequently asked Javascript interview questions and answers, 70+ Reactjs Frequent Ques & Answers, 50+ Output based ques & ans, 23+ Coding Questions & ans, 2 Machine coding ques & ans) 𝐄𝐛𝐨𝐨𝐤 𝐋𝐢𝐧𝐤: https://lnkd.in/gJMmH-PF Follow on Instagram : https://lnkd.in/gXTrcaKP #javascript #javascriptdeveloper #reactjs #reactnative #vuejsdeveloper #angular #angulardeveloper
To view or add a comment, sign in
-
🚀 Frontend Developer Roadmap If you want to become a Frontend Developer, start by building a strong foundation step by step: 1️⃣ HTML & CSS – Structure and styling of websites 2️⃣ JavaScript – Add interactivity and dynamic behavior 3️⃣ Responsive Design – Make websites work on all devices 4️⃣ Frontend Frameworks – React / Vue / Angular 5️⃣ Version Control – Git & GitHub 6️⃣ APIs – Fetch and display data from servers 7️⃣ Performance & Optimization – Faster and better user experience The key is simple: Keep learning. Keep building. Keep improving. 💻 💬 Which frontend skill are you currently learning? #frontenddeveloper #webdevelopment #javascript #coding #developers #tech
To view or add a comment, sign in
-
-
🚀 Day 9/30 – Frontend Interview Series JavaScript Promise Methods:- Today, let’s explore the most important Promise methods every developer should know 👇 🔹 1. "Promise.all()" - Runs multiple promises in parallel - Returns when all promises are resolved - Fails immediately if any one promise rejects Promise.all([p1, p2, p3]) .then(results => console.log(results)) .catch(err => console.log(err)); 👉 Best for: When all tasks are dependent on each other --- 🔹 2. "Promise.allSettled()" - Waits for all promises to complete (success or failure) - Returns status of each promise Promise.allSettled([p1, p2]) .then(results => console.log(results)); 👉 Best for: When you want results of all tasks, even if some fail --- 🔹 3. "Promise.race()" - Returns the first settled promise (resolved or rejected) Promise.race([p1, p2]) .then(result => console.log(result)) .catch(err => console.log(err)); 👉 Best for: Timeout handling or fastest response wins --- 🔹 4. "Promise.any()" - Returns the first fulfilled (resolved) promise - Ignores rejected ones (unless all fail) Promise.any([p1, p2]) .then(result => console.log(result)) .catch(err => console.log("All failed")); 👉 Best for: Getting the first successful result --- 💡 Quick Tip: - Use "all()" when everything must succeed - Use "allSettled()" when you need all outcomes - Use "race()" for speed - Use "any()" for first success --- 🔥 Mastering these methods will make your async code cleaner and more powerful! #JavaScript #Promises #AsyncJS #FrontendDeveloper #WebDevelopment #30DaysOfCode
To view or add a comment, sign in
-
Greate Insight Rushikesh Chavhan ✏️Choosing the right Promise method is key for better performance and better UX. Avoid unnecessary await chaining — it slows down your app
Front-End Developer @ Laminaar Aviation Infotech | 3 Years Experience | HTML | CSS | JavaScript | React.js | Nodejs | Web Developer | PG-DAC.
🚀 Day 9/30 – Frontend Interview Series JavaScript Promise Methods:- Today, let’s explore the most important Promise methods every developer should know 👇 🔹 1. "Promise.all()" - Runs multiple promises in parallel - Returns when all promises are resolved - Fails immediately if any one promise rejects Promise.all([p1, p2, p3]) .then(results => console.log(results)) .catch(err => console.log(err)); 👉 Best for: When all tasks are dependent on each other --- 🔹 2. "Promise.allSettled()" - Waits for all promises to complete (success or failure) - Returns status of each promise Promise.allSettled([p1, p2]) .then(results => console.log(results)); 👉 Best for: When you want results of all tasks, even if some fail --- 🔹 3. "Promise.race()" - Returns the first settled promise (resolved or rejected) Promise.race([p1, p2]) .then(result => console.log(result)) .catch(err => console.log(err)); 👉 Best for: Timeout handling or fastest response wins --- 🔹 4. "Promise.any()" - Returns the first fulfilled (resolved) promise - Ignores rejected ones (unless all fail) Promise.any([p1, p2]) .then(result => console.log(result)) .catch(err => console.log("All failed")); 👉 Best for: Getting the first successful result --- 💡 Quick Tip: - Use "all()" when everything must succeed - Use "allSettled()" when you need all outcomes - Use "race()" for speed - Use "any()" for first success --- 🔥 Mastering these methods will make your async code cleaner and more powerful! #JavaScript #Promises #AsyncJS #FrontendDeveloper #WebDevelopment #30DaysOfCode
To view or add a comment, sign in
-
"How do I become a Full Stack Developer?" Here is the exact roadmap I would follow if I was starting today: -> Stage 1: HTML Start here. No shortcuts. Learn the structure of every webpage before touching anything else. -> Stage 2: CSS Make it look good. Flexbox, Grid, responsive design. If it does not work on mobile it does not work. -> Stage 3: Git and GitHub This is not optional. Every professional developer uses version control daily. Learn it early. -> Stage 4: Build a Project Do not just watch tutorials. Build something real with what you know so far. A portfolio page. Anything. -> Stage 5: JavaScript This is the most important stage on the entire roadmap. Take your time here. Do not rush it. -> Stage 6: Pick One Frontend Framework React, Angular, Vue, or Svelte. Pick one and go deep. I recommend React. It is the most in-demand. -> Stage 7: Build Another Project Apply the framework. Build a weather app, a task manager, something with real functionality. -> Stage 8: Node.js Now we move to the backend. JavaScript on the server. Learn to handle requests and build APIs. -> Stage 9: MongoDB Your database. Learn how to store, retrieve, and manage real data. -> Stage 10: APIs Connect your frontend to your backend. This is where everything comes together. -> Stage 11: Build a Full Stack Project User authentication. Database. Frontend. Backend. Deployed live. This is what gets you hired. -> Final Stage: Full Stack Developer You can now build complete products from scratch. The roadmap is not complicated. Most people fail not because it is hard but because they stop between stages. The only thing standing between you and Full Stack Developer is consistency. Which stage are you at right now? Drop it in the comments. #FullStack #WebDevelopment #Roadmap #Developers #JavaScript #React #NodeJS #MongoDB #HTML #CSS #TechCareers
To view or add a comment, sign in
-
-
I recently attended an interview for a Senior React JS Developer role at a product-based company (Copart), TR-2. it turned out to be more than just an interview — it was a strong learning experience. What made it impactful was the focus on real-world problem solving — not just “what you know,” but how you apply it under real scenarios. Here are some real-world scenario-based questions that really made me think: 🔹 JavaScript ->In a live application where users report slowness, how would you identify whether the issue is due to the event loop blocking or inefficient code? ->You have a feature using closures, but it's causing unexpected behavior in production — how would you debug and fix it? ->A page is consuming too much memory over time — how would you detect and prevent memory leaks? ->How would you handle multiple API calls efficiently without blocking the UI? 🔹 React JS ->In a large-scale application, components are re-rendering unnecessarily — how would you identify and fix performance issues? ->You are building a real-time dashboard — how would you manage frequent state updates without affecting performance? ->How would you design component structure for scalability in a production-level app? ->A user complains about slow UI after data load — how would you optimize rendering and improve UX? 🔹 Redux -> In a complex application, state is becoming hard to manage — how would you restructure your Redux store? ->How would you handle multiple dependent API calls using Redux Thunk or Saga in a real-world scenario? ->If Redux is causing too many re-renders, how would you optimize it? ->When would you decide NOT to use Redux and choose a simpler solution? This experience reminded me of something important: 👉 Interviews are not just about getting selected — they are about discovering how much you can grow. 👉 Real-world thinking is the real skill that sets you apart. Grateful for the opportunity, the challenges, and the learning that comes with stepping out of the comfort zone. On to the next challenge 🚀 #JavaScript #ReactJS #Redux #InterviewExperience #FrontendDevelopment #CareerGrowth #KeepLearning
To view or add a comment, sign in
-
Being an Experienced frontend developer, do you really think your HTML in depth knowledge is good? Check out what I got recently Was in an interview recently. The interviewer asked me about HTML <meta> tags — viewport, charset, description, robots. Standard stuff. I was in the zone. Then came the curveball: “What happens if you remove <!DOCTYPE html> from your HTML file?” I paused for a second. I knew something bad happened, but I had never articulated it clearly. Here’s what actually happens The browser switches to Quirks Mode — it starts rendering your page using Internet Explorer 5-era rules instead of modern standards. Your CSS box model breaks. Media queries become unpredictable. Layouts go haywire. And document.compatMode would reveal "BackCompat" instead of "CSS1Compat". That single line <!DOCTYPE html> is the reason your beautifully crafted CSS doesn’t fall apart across browsers. It’s not optional. It’s a contract with the browser. This moment reminded me how much of HTML we take for granted as React developers. We’re so deep in JSX, hooks, and state management that we sometimes forget the foundation our components sit on. So I made a cheat sheet not the basic stuff you Google every day, but the bits that actually matter in interviews and real-world debugging: 1. Meta tags (including Open Graph + Twitter Cards) 2. DOCTYPE + Quirks Mode explained 3. emantic HTML5 elements 4. Accessibility attributes (ARIA, tabindex, role) 5. Performance hints (preload, prefetch, defer vs async) 6. Security attributes (SRI integrity, sandbox, crossorigin) 7. Hidden gems: <dialog>, <template>, <details> without JS 8. Data attributes + Link rel values Save this. It’ll come up when you least expect it. What’s the most unexpected HTML question you’ve been asked in an interview? Drop it below 👇 #HTML5 #Frontend #WebDevelopment #LearningInPublic #ReactDeveloper #InterviewPrep #JavaScript #FrontendEngineering
To view or add a comment, sign in
-
🚀 𝗬𝗼𝘂𝗿 𝗥𝗲𝗮𝗰𝘁 𝗹𝗶𝘀𝘁 𝗶𝘀 𝘄𝗼𝗿𝗸𝗶𝗻𝗴… 𝗯𝘂𝘁 𝘆𝗼𝘂𝗿 𝗸𝗲𝘆𝘀 𝗺𝗶𝗴𝗵𝘁 𝗯𝗲 𝘀𝗶𝗹𝗲𝗻𝘁𝗹𝘆 𝗯𝗿𝗲𝗮𝗸𝗶𝗻𝗴 𝘆𝗼𝘂𝗿 𝗨𝗜. Most developers use .map() in React. Very few truly understand why keys matter so much. Let’s fix that today 👇 𝗥𝗲𝗻𝗱𝗲𝗿𝗶𝗻𝗴 𝗟𝗶𝘀𝘁𝘀 𝗶𝗻 𝗥𝗲𝗮𝗰𝘁: 𝑐𝑜𝑛𝑠𝑡 𝑢𝑠𝑒𝑟𝑠 = ["𝑆ℎ𝑢𝑏ℎ𝑎𝑚", "𝑅𝑎ℎ𝑢𝑙", "𝐴𝑚𝑎𝑛"]; 𝑢𝑠𝑒𝑟𝑠.𝑚𝑎𝑝((𝑢𝑠𝑒𝑟) => <𝑙𝑖>{𝑢𝑠𝑒𝑟}</𝑙𝑖>); Looks fine, right? But React will throw a warning ⚠️ 👉 Because every list item needs a unique key 🔑 𝗔𝗱𝗱𝗶𝗻𝗴 𝗞𝗲𝘆𝘀 (𝗧𝗵𝗲 𝗥𝗶𝗴𝗵𝘁 𝗪𝗮𝘆) 𝑢𝑠𝑒𝑟𝑠.𝑚𝑎𝑝((𝑢𝑠𝑒𝑟, 𝑖𝑛𝑑𝑒𝑥) => ( <𝑙𝑖 𝑘𝑒𝑦={𝑖𝑛𝑑𝑒𝑥}>{𝑢𝑠𝑒𝑟}</𝑙𝑖> )); Now the warning is gone ✅ But… this is NOT always correct ❌ 🔥 𝗪𝗵𝗮𝘁 𝗔𝗿𝗲 𝗞𝗲𝘆𝘀 𝗥𝗲𝗮𝗹𝗹𝘆 𝗙𝗼𝗿? Keys help React 𝗶𝗱𝗲𝗻𝘁𝗶𝗳𝘆 𝘄𝗵𝗶𝗰𝗵 𝗶𝘁𝗲𝗺𝘀 𝗰𝗵𝗮𝗻𝗴𝗲𝗱, 𝗮𝗱𝗱𝗲𝗱, 𝗼𝗿 𝗿𝗲𝗺𝗼𝘃𝗲𝗱. 👉 React uses keys during 𝗿𝗲𝗰𝗼𝗻𝗰𝗶𝗹𝗶𝗮𝘁𝗶𝗼𝗻 (𝗱𝗶𝗳𝗳𝗶𝗻𝗴) 👉 It decides 𝘄𝗵𝗮𝘁 𝘁𝗼 𝘂𝗽𝗱𝗮𝘁𝗲 𝗶𝗻𝘀𝘁𝗲𝗮𝗱 𝗼𝗳 𝗿𝗲-𝗿𝗲𝗻𝗱𝗲𝗿𝗶𝗻𝗴 𝗲𝘃𝗲𝗿𝘆𝘁𝗵𝗶𝗻𝗴 ⚠️ 𝗪𝗵𝘆 𝗨𝘀𝗶𝗻𝗴 𝗜𝗻𝗱𝗲𝘅 𝗮𝘀 𝗞𝗲𝘆 𝗖𝗮𝗻 𝗕𝗲 𝗗𝗮𝗻𝗴𝗲𝗿𝗼𝘂𝘀 If your list changes (add/remove/reorder): ● Wrong items may re-render ● UI bugs can appear ● State may get mixed up ✅ 𝗕𝗲𝘀𝘁 𝗣𝗿𝗮𝗰𝘁𝗶𝗰𝗲 𝑢𝑠𝑒𝑟𝑠.𝑚𝑎𝑝((𝑢𝑠𝑒𝑟) => ( <𝑙𝑖 𝑘𝑒𝑦={𝑢𝑠𝑒𝑟.𝑖𝑑}>{𝑢𝑠𝑒𝑟.𝑛𝑎𝑚𝑒}</𝑙𝑖> )); ✔️ Always use a 𝘂𝗻𝗶𝗾𝘂𝗲 & 𝘀𝘁𝗮𝗯𝗹𝗲 𝗶𝗱 ✔️ Avoid index unless list is static 🧠 𝗤𝘂𝗶𝗰𝗸 𝗥𝘂𝗹𝗲 Keys are not for React warnings… They are for 𝗰𝗼𝗿𝗿𝗲𝗰𝘁 𝗨𝗜 𝗯𝗲𝗵𝗮𝘃𝗶𝗼𝗿. 🔑 𝗙𝗶𝗻𝗮𝗹 𝗧𝗮𝗸𝗲𝗮𝘄𝗮𝘆 .map() renders the list… but 𝗸𝗲𝘆𝘀 𝗺𝗮𝗸𝗲 𝗶𝘁 𝗲𝗳𝗳𝗶𝗰𝗶𝗲𝗻𝘁 𝗮𝗻𝗱 𝗽𝗿𝗲𝗱𝗶𝗰𝘁𝗮𝗯𝗹𝗲. 🚀 Follow Shubham Kumar Raj for more such content. 💡 Part of my #FrontendRevisionMarathon — breaking down React concepts one day at a time 🚀 Have you ever faced bugs because of wrong keys? Let’s discuss 👇 #React #Frontend #WebDevelopment #JavaScript #ReactJS #FrontendRevisionMarathon #Performance #FrontendRevisionMarathon #frontenddeveloper #codinginterview #programming #learnjavascript #interviewprep #CareerGrowth #SowftwareEngineering #Hiring #OpenToWork #Post #100DaysOfCode
To view or add a comment, sign in
-
-
Nobody talks about this shift in web development. 2 years ago, a web developer needed: → HTML, CSS, JavaScript → Maybe a framework like React Today, the same job expects: → TypeScript (not just JS) → Next.js or similar meta-framework → Tailwind CSS for styling → REST & GraphQL API knowledge → Git, CI/CD basics → And now — AI-assisted coding too The job title stayed the same. The skill set doubled. This is why junior devs are struggling to get hired — they learned the old list, not the new one. Are you keeping your skills updated? 👇 #webdeveloper #AiDeveloper #Aimarket
To view or add a comment, sign in
-
Frontend is not about how many frameworks you know. It’s not a race between Angular vs React vs Vue. And it’s definitely not about adding one more library to your resume every month. Frontend is about understanding the why behind what you build. Can you: • Structure a UI so it scales? • Manage state without creating chaos? • Write code that another developer can actually read? • Think about performance before users complain? • Build something that feels simple to the user… even if it’s complex underneath? Frameworks will change. Trends will shift. But fundamentals? They stay. I’ve seen developers jump from one framework to another… but still struggle with the same problems. Because the real skill isn’t “knowing a framework” — it’s knowing how the web works. So instead of asking: 👉 “Which framework should I learn next?” Start asking: 👉 “Am I actually getting better at frontend?” #FrontendDevelopment #WebDevelopment #SoftwareEngineering #Angular #React #Learning #CareerGrowth
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