𝐈𝐧 𝐉𝐚𝐯𝐚𝐒𝐜𝐫𝐢𝐩𝐭, 𝐟𝐮𝐧𝐜𝐭𝐢𝐨𝐧𝐬 𝐚𝐫𝐞 𝐧𝐨𝐭 𝐣𝐮𝐬𝐭 𝐟𝐮𝐧𝐜𝐭𝐢𝐨𝐧𝐬… They’re values. You can: • Pass them as arguments • Return them from other functions • Assign them to variables This is what makes patterns like callbacks, closures, and higher-order functions possible. But many developers use these without fully understanding them. We’ve broken it down with simple examples in our latest blog. Read here: https://lnkd.in/gEWNYg_p #JavaScript #Programming #WebDevelopment
JavaScript Functions as Values and Variables
More Relevant Posts
-
Here is the final part of our weekly series on object Destructuring. Functions, Rest and Pro Patterns. If our content has been of great help to you. Drop a comment or a suggestion on how we can do better. #programming #javascript
To view or add a comment, sign in
-
Came across a classic JavaScript interview question today! 💡 👉 Find the first repeating character in a string. 🔹 The trick is simple track characters as you iterate and return the first one you’ve already seen. 🧠 Key Insight: “Seen before? Return immediately.” — no need for nested loops or sorting. This approach gives an efficient O(n) solution 🚀 #JavaScript #CodingInterview #DSA #WebDevelopment #Programming #TechSkills #CareerGrowth
To view or add a comment, sign in
-
-
⚡ JavaScript Fact: Did you know? "async/await" makes your code cleaner than traditional promises. Instead of messy callbacks: 👉 Write readable, structured code Cleaner code = Faster development 🚀 #JavaScript #Coding #WebDevelopment #Programming
To view or add a comment, sign in
-
-
this in JavaScript looks simple… until it starts pointing to the wrong thing 😵 Same function, different outputs — just because of how it’s called. So what does this actually mean? 👉 It’s not about where the function is written 👉 It’s about who is calling the function In this blog, I’ve explained: What this really represents this in global context this inside objects and functions How calling context changes everything Kept it simple with clear examples (no unnecessary theory) ✨ 🔗 Read here: https://lnkd.in/dMkPffeA Would appreciate your feedback 🙌 #javascript #webdevelopment #programming #coding
To view or add a comment, sign in
-
-
💡 JavaScript Challenge function sum(a, b) { return a + b; } function sumCurried(a) { return function(b) { return a + b; }; } console.log(sum(5, 4)); console.log(sumCurried(5)(4)); ❓ What’s the output? Two different approaches… one result. But here’s the real question 👇 Are you more curious about the answer… or how both paths lead there? 👇 Drop your answer below! 🔗 Follow me for more insights on coding, creativity & branding. #JavaScript #WebDevelopment #CodingChallenge #Curiosity #Programming #Developers #LearnToCode
To view or add a comment, sign in
-
-
Why does this print 4 4 4 4 in JavaScript? 🤯 A small setTimeout() + var question that teaches a big concept: closures, scope, and async behavior. When you understand why it happens, JavaScript starts making much more sense. #JavaScript #WebDevelopment #Programming #Coding #FrontendDevelopment #SoftwareEngineering #Developer #TechCommunity #LearnToCode #AsyncJavaScript #Closures #SetTimeout #100DaysOfCode #CodingTips #JavaScriptDeveloper
To view or add a comment, sign in
-
-
Understanding JavaScript Variables Variables are the foundation of programming — they store data that your application can use and modify. 📌 Types of Variables: 🔹 Local Variables Declared inside a function Accessible only within that function 🔹 Global Variables Declared outside functions Accessible from anywhere in the script 💡 Key Insight: Use local variables for better control and avoid unnecessary global variables to prevent conflicts. 👉 How do you manage variable scope in your projects? #JavaScript #WebDevelopment #Frontend #Coding #Developers #Learning #Programming
To view or add a comment, sign in
-
-
LeetCode Day 23 : Problem 3 (Longest Substring Without Repeating Characters) Just solved my LeetCode problem for today. It was "Longest Substring Without Repeating Characters", find the length of the longest substring with all unique characters. The brute force is obvious. Check every possible substring, verify it has no duplicates, track the longest. That's O(n³) if you're checking naively or O(n²) with a set. It works but it's doing the same work over and over for substrings that share most of their characters. The sliding window collapses it to O(n). The idea is simple. Maintain a window between a left and right pointer. Expand right freely, adding each character to a Set. The moment you try to add a character that's already in the Set, you have a duplicate inside your window. Shrink from the left, removing characters one by one, until the duplicate is gone. Then add the new character and continue. The Set is doing two jobs at once. It tells you instantly whether a duplicate exists in the current window, and it holds exactly the characters in that window so you know what to remove when shrinking. The length of the current valid window at any point is right - left + 1. You track the maximum of that across every step. What makes this O(n) even with the inner while loop is the same reason every sliding window is O(n). Each character enters the window exactly once when right passes over it, and leaves the window exactly once when left passes over it. The total work across the entire loop is 2n regardless of how much the window shrinks and grows. The real lesson? When a brute force solution recomputes overlapping subproblems, ask whether you can maintain state incrementally instead. A Set tracking exactly what's inside the window turns a rebuild-from-scratch approach into a simple add-one-remove-one operation at each step. #DSA #LeetCode #JavaScript #CodingJourney #Programming
To view or add a comment, sign in
-
-
30 Days JavaScript Challenge : Day 24 ✅ Today’s problem was about sorting an array using a custom function. Instead of directly sorting values, we use a function fn to decide the order — basically telling JavaScript how to compare elements. At first it feels simple, but it actually shows how powerful sorting can be when you control the logic: Sorting objects based on a property Sorting nested arrays Custom ranking based on conditions It’s one of those concepts that looks basic but is used everywhere in real projects. Slowly getting more clarity on how to write flexible and reusable logic in JavaScript. #javascript #leetcode #webdevelopment #frontenddeveloper #codingchallenge #learninginpublic #developers #programming #buildinpublic
To view or add a comment, sign in
-
-
30 Days JavaScript Challenge: Day 25 ✅ Today’s problem was about merging two arrays of objects based on a common key (id). Sounds simple at first, but it had a few interesting parts: Handling unique ids Merging objects when ids match Making sure values from the second array override the first Keeping everything sorted It’s actually very close to real-world scenarios like combining data from two APIs or updating existing records with new data. Problems like this make you think more about data handling and structure, not just loops and conditions. Day by day, things are starting to connect better. 🚀 #javascript #leetcode #webdevelopment #frontenddeveloper #codingchallenge #learninginpublic #developers #programming #buildinpublic #JavaScriptMastery
To view or add a comment, sign in
-
More from this author
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