While revisiting JavaScript fundamentals, I had a small but interesting realization. When we do something like: "hello world".toUpperCase() we are calling a method on a primitive value. But primitives don’t actually have methods. Behind the scenes, JavaScript temporarily boxes the primitive into its object wrapper (like String) so the method can run, and then discards it. Small detail, but it explains why methods like toUpperCase() work on strings without us ever creating new String(). Sometimes revisiting the basics reveals the most elegant parts of JavaScript. #JavaScript #WebDevelopment #Programming #JSFundamentals
JavaScript String Method Temporarily Boxes Primitives
More Relevant Posts
-
Loop Less, Map More: Why Modern JavaScript Means Masterful Array Methods. 🚀 We all know how to write a traditional for loop, but in the modern JS landscape, it's not just about getting the job done—it's about writing clean, readable, and performant code. Understanding built-in array methods like .map(), .filter(), and .reduce() is one of the quickest ways to elevate your codebase. They clearly communicate your intention to other developers and promote data immutability, reducing bugs. Check out the infographic below for a visual breakdown! 👇 #JavaScript #WebDevelopment #CleanCode #Programming #CodingTips
To view or add a comment, sign in
-
-
💡 Learning Something New in JavaScript Today! Today I learned about the padStart() method in JavaScript. It’s a simple but very useful string method that helps format values by adding characters to the beginning of a string until it reaches a desired length. Example: "5".padStart(3, "0") // Output: "005" This is especially helpful when formatting: Dates and times (e.g., 09, 07) Serial numbers or IDs Counters and timers Small concepts like these make code cleaner and more readable. Excited to keep exploring more JavaScript features every day! #JavaScript #WebDevelopment #CodingJourney #FrontendDevelopment
To view or add a comment, sign in
-
Javascript concept: var vs let vs const I used var everywhere when I started learning JavaScript… Everything worked… until it didn’t. var a = 10; let b = 20; const c = 30; Then I learned: var ignores block scope ❌ let respects it ✅ const prevents reassignment 🔒 💡 Now my rule: → Use const by default → Use let only when needed #JavaScript #WebDevelopment #Frontend #Coding
To view or add a comment, sign in
-
🚀 Learning JavaScript? Start with Strings. Strings are one of the most used things in JavaScript. If you can work with text, you can build forms, messages, search features, and much more. Let’s understand the basics 👇 • Create a string using quotes let name = "JavaScript"; • Find string length name.length • Join strings together "Hello " + "World" • Change text case name.toUpperCase() or name.toLowerCase() • Get part of a string name.substring(0,4) Small concept… but used everywhere in real projects. Master the basics → coding becomes easier. #JavaScript #WebDevelopment #FrontendDevelopment #LearnToCode #ProgrammingBasics #JavaScriptTips #CodingForBeginners #DeveloperCommunity #TechEducation #SoftwareDevelopment
To view or add a comment, sign in
-
-
Just dropped a new article on Medium🎉 The `this` Keyword in JavaScript — Finally Explained Simply `this` confuses almost every JavaScript developer at some point. I wrote this to make it click — with clear examples, a cheat sheet, and zero fluff. 🔗 https://lnkd.in/dTnbXxnx If you find it useful, share it with someone who's learning JS! 🚀 For More articles 🔗https://lnkd.in/g7rcikTM #JavaScript #Frontend #WebDevelopment #Programming
To view or add a comment, sign in
-
-
Have you ever struggled with variable scope in JavaScript? You're not alone! Many developers often overlook closures, leading to unexpected behavior when functions are nested. Imagine you're working in a team, and a colleague writes a function that relies on a variable declared outside its scope. When you call this function in a different context, it fails because that variable isn’t available anymore. A good rule of thumb is to use closures whenever you need to maintain state across function calls without polluting the global scope. However, junior developers often trip up by not realizing that closures can create memory leaks if not handled properly. Remember, mastering closures can significantly enhance your code quality and maintainability. Embrace this concept, and you'll unlock a new level of proficiency in JavaScript! 🚀💡💻 #programming #javascript #coding
To view or add a comment, sign in
-
-
I just published my first VS Code Extension to make coding a lot more fun! 🎉 It's a fun project called "NICE on Success". It basically plays random meme sounds the moment you finish executing tasks or typing commands in your VS Code terminal. 🔊😂 If you don't mind, check it out, it could be fun! [https://lnkd.in/eScMvb9r] #VSCode #VSCodeExtension #JavaScript #TypeScript #JS #TS #ProgrammingMemes #DeveloperHumor #WebDevelopment #CodingLife
To view or add a comment, sign in
-
🚀 Day 22 of My JavaScript Learning Journey Today I learned how to create Array Prototype Last in JavaScript. This method helps us easily get the last element of an array. If the array is empty, it returns -1. By extending Array.prototype, we can create a custom method that works with any array. ✨ What I learned today: ✅ Understanding Array.prototype ✅ Extending built-in JavaScript objects ✅ Accessing the last element of an array ✅ Writing reusable utility methods Learning about prototypes helps understand how JavaScript objects really work under the hood ⚡ #Day22 #JavaScript #ArrayPrototype #WebDevelopment #CodingJourney #LearningInPublic #coddy
To view or add a comment, sign in
-
-
just built a digital clock using javascript. sounds simple, but not gonna lie… seeing time update automatically felt cooler than it should have . Finally understanding how javascript actually makes a webpage *do* things instead of just sitting there looking pretty. small project, but big confidence boost. trying to move from “watched tutorial” to “ok wait I can build stuff now”. github link in comments. #buildinpublic #javascript #codingjourney #learning
To view or add a comment, sign in
-
> Day 12/21 : JavaScript Control Flow As part of my 21-Day Full Stack Revision Challenge, today I revised control flow in JavaScript, which helps programs make decisions and repeat tasks. Control flow is important because it allows the program to execute different actions based on conditions. > Topics I Covered If–Else Statements – Used to execute code based on conditions Switch Statements – A cleaner way to handle multiple conditions Loops – Used to repeat a block of code multiple times > Why It Matters Control flow helps developers build logical and dynamic programs by controlling how and when code runs. Day 12 completed #FullStackDeveloper #JavaScript #WebDevelopment #LearningInPublic #21DaysChallenge #CodingJourney
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