The new keyword looks simple… but most people use it without knowing what it actually does 👀 That’s exactly where confusion starts. Why does a function suddenly create objects? Where does this point? And how do methods magically appear? 👉 It’s all because of new. In this blog, I’ve explained: What new actually does behind the scenes How constructor functions create objects How objects link to shared methods (prototype) Why everything breaks without new Kept it simple, with step-by-step explanation and examples ✨ 🔗 Read here: https://lnkd.in/dyZwek-x Would love your feedback 🙌 Next: Constructor Functions or this keyword? #javascript #webdevelopment #programming #coding
What Does New Do in JavaScript
More Relevant Posts
-
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
-
-
🧠 Coding Challenge: Merge Sorted Arrays Here’s a simple-looking problem that tests your logic and attention to detail 👇 You are given two sorted arrays: let arr1 = [1, 5, 8, 9] let arr2 = [3, 4, 6, 10] 🎯 Task: Merge these two arrays into a single sorted array. Sounds easy, right? But there’s a catch… 👀 Think about: - How will you compare elements efficiently? - What happens when one array finishes before the other? - Are you sure your loop covers all cases? ⏳ Take a moment and try solving it yourself before scrolling further. 💬 If you get stuck or want to verify your approach, check the answer in the comments! #JavaScript #CodingChallenge #DSA #Programming #WebDevelopment
To view or add a comment, sign in
-
-
🚀 Day 37/128 of My LeetCode Challenge Solved: Search Insert Position on LeetCode 🔹 Problem: Given a sorted array of distinct integers and a target value, return the index if the target exists. Otherwise, return the position where it should be inserted in sorted order. 💡 Approach: Used Binary Search to achieve O(log n) time complexity by repeatedly dividing the search space in half. ✅ Key takeaway: Sometimes the answer isn’t just finding an element — it’s understanding where it belongs when it doesn’t exist. Binary search makes this super efficient. Consistency > perfection. One problem at a time 💯 #LeetCode #128DaysOfCode #CodingChallenge #JavaScript #DSA #BinarySearch #Programming #SoftwareEngineering
To view or add a comment, sign in
-
-
Closures look confusing at first, but the core idea is simple: A closure is when a function remembers variables from the scope where it was created, even after that outer function has finished running. That is why closures are so useful for private state, counters, factories, and callbacks. The infographic breaks it down visually: create a variable, return an inner function, and that inner function keeps access to the remembered value. If you understand this, a lot of JavaScript starts making more sense. What JavaScript concept should I simplify next? #JavaScript #Closures #WebDevelopment #FrontendDevelopment #Programming #LearnToCode #ReactJS #SoftwareEngineering
To view or add a comment, sign in
-
-
Turning concepts into clarity 💡 Exploring Arrays & Array Functions with a developer-style visual inspired by VS Code. Simple, structured, and beginner-friendly — because good code starts with strong fundamentals. #Programming #JavaScript #Coding #WebDevelopment #Learning
To view or add a comment, sign in
-
-
🚀 Today I Practiced JavaScript: Quick Sort Algorithm: Sorting is one of the most fundamental concepts in programming, and Quick Sort is a powerful algorithm every developer should know. 💡 Core Concept: Quick Sort follows a divide and conquer approach: 1. Divide the array into smaller parts based on a pivot 2.Conquer by recursively sorting the smaller parts 3.Combine the results to get the final sorted array 🎯 Key Insight: In my JavaScript implementation: 1.I used push() to partition elements into smaller and larger groups 2.I used the spread operator (...) to combine the results efficiently 3.This approach keeps the logic simple while clearly demonstrating how the algorithm works internally. ⚡ Time Complexity: 1. Average: O(n log n) 2. Worst: O(n²) Quick Sort is widely used because of its efficiency and elegant approach to problem-solving. #JavaScript #DSA #Algorithms #Coding #Programming #WebDevelopment #Quick Sort 😊
To view or add a comment, sign in
-
🎯 Just built a Number Guessing Game — and it taught me more than I expected! I recently completed a hands-on project where I built a Number Guessing Game from scratch, and it was a fantastic exercise in logic, loops, and user interaction. 🔧 What I worked on: ✅ Random number generation ✅ User input handling & validation ✅ Conditional logic & loop structures ✅ Feedback messages (too high / too low / correct!) ✅ Attempt tracking & game flow 💡 This project helped me strengthen my fundamentals in JavaScript and understand how small projects can sharpen core programming concepts. Whether you're a beginner or brushing up on basics — hands-on projects are the fastest way to learn! 🎥 Watch the demo in the video below! 🚀 More projects coming soon. Follow along if you're on a similar learning journey! #coding #programming #handsonlearning #projectbased #numberguessinggame #javascript #beginners #learntocode #buildinpublic #NxtwaveCCBP
To view or add a comment, sign in
-
Event Bubbling vs Event Capturing: Mastering DOM Event Propagation Learn the difference between event bubbling and event capturing, when to use each, and how to implement them with clean, production‑ready JavaScript code. This tutorial walks you through concepts, practical examples, and best‑practice patterns. Read the full article 👇 https://lnkd.in/gYXpk-ST #JavaScript #WebDevelopment #Programming #Coding #Tech #EventPropagation #DOMEvents #EventBubbling #EventCapturing #FrontendEngineering #DigitalTransformation #FutureOfWork
To view or add a comment, sign in
-
-
JavaScript gets confusing… until it comes to life. I created this short comic to visualize something many beginners struggle with: 👉 var – flexible, but chaotic 👉 let – controlled flexibility 👉 const – stable and predictable 👉 undefined – the mystery we all run into 👉 function – trying to keep everything running Because learning to code isn’t just about syntax—it’s about understanding behavior. And sometimes the best way to teach that… is to see it play out. “Control the code… or the code controls you.” This is exactly how I approach teaching: Make concepts visual Make them memorable Make them feel real Curious—what’s been your biggest “aha” moment with JavaScript? #JavaScript #LearnToCode #WebDevelopment #Coding #Programming #EdTech #VibeCoding #AIinEducation
To view or add a comment, sign in
-
-
What is the difference between let, var, and const? `var`, `let`, and `const` are used to declare variables in JavaScript, but they behave differently. `var` is the older way and has function scope, which can lead to unexpected behavior. It also allows redeclaration and can be updated freely. `let` is block-scoped, meaning it only exists within the block where it’s defined. It can be updated but not redeclared in the same scope, making it safer than `var`. `const` is also block-scoped but cannot be reassigned after it’s declared. It’s used for values that should not change. Overall, `let` and `const` are preferred in modern JavaScript. #webdeveloper #tech #coding #programming
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