Lately, I’ve been revisiting some core JavaScript concepts, and today I stumbled upon something I hadn’t really paid attention to before — Symbols. They’re not something you see in everyday code, but I found them really interesting. A Symbol is a unique and immutable value that can be used as a key in objects. What I like about Symbols is that each one is completely unique, even if it has the same description: Symbol("id") === Symbol("id"); // false They can be super useful when you need unique property keys in an object — especially to avoid accidental overwriting. Even if I might not use them often, I enjoy discovering these little parts of JavaScript that make the language more powerful than it first seems. #JavaScript #WebDevelopment #LearningEveryDay
Denisa Greceanu’s Post
More Relevant Posts
-
"this" in JavaScript isn’t what you think it is. It doesn’t mean “this function”, it means “the object that called the function.” That’s why "this" changes depending on how the function is called. Arrow functions don’t have their own this. They inherit it from their parent scope, perfect for callbacks, but confusing inside classes and objects. That’s why in React or classes you often see .bind(this) in event handlers because without it, "this" gets lost when the function runs. So next time "this" is undefined, remember, It’s not you. It’s JavaScript being… JavaScript. #this #javascript
To view or add a comment, sign in
-
💡 JavaScript Challenge: Check if Two Words Are Anagrams Here’s a simple yet powerful JavaScript solution to check if two strings are anagrams of each other 💻 🔍 What’s an Anagram? An anagram is a word formed by rearranging the letters of another — for example: 👉 listen → silent ✅ 👉 hello → world ❌ 🧠 Logic Behind the Code: Compare lengths of both strings. Count occurrences of each character in the first string. Decrease the count for each character in the second string. If all counts match, they’re anagrams! #JavaScript #CodingChallenge #100DaysOfCode #WebDevelopment #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Dynamic DOM Manipulation with JavaScript 💻 Just explored how to create an unordered list dynamically using JavaScript DOM methods like createElement(), appendChild(), and textContent. No hardcoding — everything gets generated through JS! 🔥 This small step helped me understand how JavaScript interacts with the DOM and how elements can be created, modified, and added dynamically. 🌿 💡 Tech used: HTML, JavaScript (DOM) 📁 Output: “fruit 1 to fruit 5” list generated automatically 🍎 #JavaScript #FrontendDevelopment #WebDevelopment #LearningJourney #DOM #CodingPractice #DeveloperInProgress #WomenInTech #HTML #JSBeginners #CodeNewbie
To view or add a comment, sign in
-
-
Did you know this about JavaScript? In JavaScript: [ ] == ![ ] is true. Wait, what? Here’s why: ![ ] becomes false because an empty array is truthy. So the expression becomes [ ] == false. JavaScript tries to convert both sides to the same type. Number([ ]) is 0, and Number(false) is also 0. Therefore, 0 == 0 → true. This is one of the reasons developers say: "JavaScript is simple… until it isn’t." I’m currently learning JavaScript and finding these little quirks really fascinating. If you’re also learning, what’s the weirdest or most surprising thing you’ve discovered so far? #JavaScript #WebDevelopment #CodingJourney #100DaysOfCode #DidYouKnow #LearnInPublic #FrontendDevelopment
To view or add a comment, sign in
-
-
🧠 Understanding Lexical Environment in JavaScript Ever wondered how JavaScript knows where to find your variables? 🤔 It’s all because of something called the Lexical Environment. A Lexical Environment is created every time an Execution Context is created — whether it’s the global scope or inside a function. Each Lexical Environment has two parts: 1️⃣ Local Memory – where variables and functions live. 2️⃣ Reference to the Parent Environment – the place where the function was defined (not called). When functions are nested, they form a chain of environments. That chain is called the Scope Chain 🌐 Example 👇 function a() { function c() { console.log("Hello"); } c(); } a(); 🧩 Here’s how the chain looks: c() → inside a() a() → inside Global Environment Global → has no parent (null) ✨ In simple words: Lexical Environment = Local Memory + Reference to Parent Environment The chain of these references = Scope Chain If you understand this concept, you’ve unlocked one of the core building blocks behind scope and closures in JavaScript 🚀 #JavaScript #WebDevelopment #LearningInPublic #MERN #Frontend #CodingJourney
To view or add a comment, sign in
-
-
🚀 JavaScript Core Concept: Hoisting Explained Ever wondered why you can call a variable before it’s declared in JavaScript? 🤔 That’s because of Hoisting — one of JavaScript’s most important (and often misunderstood) concepts. When your code runs, JavaScript moves all variable and function declarations to the top of their scope before execution. 👉 But here’s the catch: Variables (declared with var) are hoisted but initialized as undefined. Functions are fully hoisted, meaning you can call them even before their declaration in the code. 💡 Example: console.log(name); // undefined var name = "Ryan"; During compilation, the declaration var name; is moved to the top, but the assignment (= "Ryan") happens later — that’s why the output is undefined. 🧠 Key Takeaway: Hoisting helps JavaScript know about variables and functions before execution, but understanding how it works is crucial to avoid tricky bugs. #JavaScript #WebDevelopment #Frontend #ProgrammingConcepts #Learning #Hoisting #CodeTips
To view or add a comment, sign in
-
-
Are you writing clean, high-performance JavaScript? 🚀 Stop making these common mistakes! This guide is packed with essential JS best practices to instantly level up your code quality and speed: -> Ditch var 🚫: Always use let and const to declare variables to prevent scope and redefinition errors. -> Optimize Loops ⏱️: Boost performance by reducing activity inside loops, like calculating array length once outside the loop. -> Minimize DOM Access 🐌: Accessing the HTML DOM is slow. Grab elements once and store them in a local variable if you need to access them multiple times. -> Use defer ⚡: For external scripts, use the defer attribute in the script tag to ensure the script executes only after the page has finished parsing. -> Meaningful Names ✍️: Use descriptive names like userName instead of cryptic ones like un or usrnm for better long-term readability. -> Be Thoughtful about Declarations 💡: Avoid unnecessary declarations; only declare when strictly needed to promote proper code design. Swipe and save these tips for cleaner, faster JS code! Which practice are you implementing first? 👇 To learn more about JavaScript, follow JavaScript Mastery #JavaScript #JS #WebDevelopment #CodingTips #Performance #CleanCode #DeveloperLife #TechSkills
To view or add a comment, sign in
-
Are you writing clean, high-performance JavaScript? 🚀 Stop making these common mistakes! This guide is packed with essential JS best practices to instantly level up your code quality and speed: -> Ditch var 🚫: Always use let and const to declare variables to prevent scope and redefinition errors. -> Optimize Loops ⏱️: Boost performance by reducing activity inside loops, like calculating array length once outside the loop. -> Minimize DOM Access 🐌: Accessing the HTML DOM is slow. Grab elements once and store them in a local variable if you need to access them multiple times. -> Use defer ⚡: For external scripts, use the defer attribute in the script tag to ensure the script executes only after the page has finished parsing. -> Meaningful Names ✍️: Use descriptive names like userName instead of cryptic ones like un or usrnm for better long-term readability. -> Be Thoughtful about Declarations 💡: Avoid unnecessary declarations; only declare when strictly needed to promote proper code design. Swipe and save these tips for cleaner, faster JS code! Which practice are you implementing first? 👇 To learn more about JavaScript, follow JavaScript Mastery #JavaScript #JS #WebDevelopment #CodingTips #Performance #CleanCode #DeveloperLife #TechSkills
To view or add a comment, sign in
-
🚀 Today I learned about the this keyword in JavaScript! When I first came across this, it honestly confused me a lot 😅. The tricky part is that this doesn’t have one fixed meaning — it changes depending on where it’s used. 👉 For example, in the global scope it refers to the window (in browsers), inside an object method it points to that object, inside a class it refers to the class instance, and in event listeners it represents the element that triggered the event. At first, it felt so weird and hard to understand, but after experimenting with small examples, things slowly started to click 💡. Now I realize that understanding this is actually key to mastering how JavaScript handles context and objects. If you’re also struggling with this, don’t worry — everyone does at the beginning. Keep practicing and it will eventually make sense! 💪 #JavaScript #WebDevelopment #FrontendDeveloper #LearningInPublic #CodingJourney
To view or add a comment, sign in
-
-
🚀 JavaScript Trick You Should Know! What do you think the result will be? 👇 "5" + 2 // ? "5" - 2 // ? ✅ "5" + 2 → "52" ✅ "5" - 2 → 3 Why? Because (+) combines strings, while (-) forces JavaScript to convert "5" into a number. A small example — but it shows how type coercion can completely change your output. ⚡ #JavaScript #FrontendDevelopment #CodingTips
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