💻✨ JavaScript String Methods – Practice Tasks Completed! I recently completed a series of practical exercises to strengthen my understanding of JavaScript string manipulation. These tasks covered common string methods, from basic character access to advanced formatting and substring operations. 🧩 Tasks & Key Learnings: Character Finder: Used charAt(), charCodeAt(), and .at() to find characters and ASCII values. Combine & Search: Combined strings with concat(). Searched using includes(), indexOf(), and lastIndexOf(). Text Formatting: Trimmed spaces (trim(), trimStart(), trimEnd()) and changed case (toUpperCase(), toLowerCase()). Extract Substrings: Extracted portions of strings using slice() and substring(). Padding Magic: Added characters to start or end of a string using padStart() and padEnd(). Replace & Compare: Replaced text using replace() & replaceAll() and compared strings using localeCompare(). Mixed Operations (Mini Project): Built a function analyzeString() to return a comprehensive analysis of a string: length, first & last characters, uppercase/lowercase, inclusion of a word, slicing, and trimmed version. 🎯 Outcome: By completing these tasks, I enhanced my ability to: Access and manipulate string data effectively Apply multiple string methods in combination Solve real-world problems involving text processing 💡 These exercises are a great way to solidify fundamental JavaScript skills and prepare for more advanced projects and challenges! #JavaScript #WebDevelopment #FrontendDevelopment #Coding #LearningJourney #Programming #StringMethods #DeveloperSkills #TechSkills #Coding #JS #SpandanaChowdary #MeghanaM #10000Coders
More Relevant Posts
-
🧠 Learning Journey — JavaScript (Objects, Strings & Arrays) In the last two days, I explored and practiced some powerful JavaScript concepts that are essential for real-world coding 👇 🔹 Object Concepts & Methods Object creation, properties & nested objects Methods like: Object.keys(), Object.values(), Object.entries() Object.assign(), Object.freeze(), Object.seal(), Object.create() Practiced a function like deepFreeze() to make nested objects immutable 🔹 String Methods length, charAt(), charCodeAt() indexOf(), includes(), slice(), substring(), substr() replace(), replaceAll(), split(), toUpperCase(), repeat() 🔹 Array Methods push(), pop(), filter(), map(), reduce() find(), some(), every(), sort(), splice(), indexOf() 💻 Each concept strengthened my understanding of how data is stored, accessed, and manipulated in JavaScript. Next, I’ll be moving into advanced topics and mini projects using these methods 🚀 #JavaScript #WebDevelopment #LearningJourney #CodingEveryday #Frontend #Objects #Strings #Arrays #DeveloperJourney
To view or add a comment, sign in
-
-
🚀 Day 41 of #100DaysOfWebDevelopment Challenge Today, I explored some of the most commonly used JavaScript String Methods — tools that help manipulate and format text efficiently. 🔹 trim() The trim() method removes any unnecessary whitespace from the beginning and end of a string. It’s extremely useful when handling user input or text data that may contain extra spaces. 🔹 toUpperCase() & toLowerCase() These methods convert text to uppercase or lowercase, helping in formatting or case-insensitive comparisons. For example: "hello".toUpperCase() → "HELLO" 🔹 String Methods with Arguments Some string methods accept arguments — values you pass inside parentheses to control their behavior. For instance, indexOf("a") returns the position of the first occurrence of the letter "a" in a string. 🔹 indexOf() This method helps find the index (position) of a specific character or substring. It returns -1 if the value isn’t found — making it handy for search operations in text. 🔹 Method Chaining I learned that multiple methods can be combined in a single line — known as method chaining. 🔹 slice() The slice() method extracts a part of a string and returns it as a new string without modifying the original. 🔹 replace() This method replaces a specified value with another value in a string. It’s very useful for text transformation or cleaning data. 🔹 repeat() Finally, I explored the repeat() method, which repeats a string a specified number of times — great for generating patterns or visual output. #100DaysOfCode #WebDevelopment #JavaScript #FrontendDevelopment #LearningInPublic #CodingJourney
To view or add a comment, sign in
-
-
🔥 JavaScript: When “prototype” is NOT an object 👀 We all learn early — > “Every function in JavaScript has a prototype property that is an object.” But JavaScript loves exceptions 😏 Here are some surprising cases where prototype is not an object 👇 RegExp.prototype // → /(?:)/ Array.prototype // → [] Function.prototype // → ƒ () {} Number.prototype // → Number {} String.prototype // → String {} Boolean.prototype // → Boolean {} Symbol.prototype // → Symbol {} BigInt.prototype // → BigInt {} 💡 Notice something? Some of these are functions, arrays, or even regular expressions! That’s because their prototypes are actual instances of their types, not plain objects — so that all instances inherit their core methods directly. For example: Array.prototype.push === [].push // true ✅ RegExp.prototype.test === /abc/.test // true ✅ So next time you assume prototype is always {}, remember — JS is full of living examples 😉 --- 💬 Have you ever found a weird prototype behavior while debugging? Drop it in the comments — let’s break more JS myths together! ⚙️ #JavaScript #WebDevelopment #LearningEveryday #Frontend
To view or add a comment, sign in
-
🌐 Introduction to JavaScript JavaScript is a lightweight, interactive scripting language that comes with many built-in methods. It plays a key role alongside HTML and CSS to make webpages dynamic and engaging. 🧩 Where JavaScript Is Used JavaScript is used in web development to: Add interactivity Handle user input Communicate with servers for dynamic content 💻 Example Script // Display an alert message window.alert("This is an alert message!"); // Print output to the console console.log("Hello from JavaScript!"); ⚙️ Features of JavaScript ✅ Easy to use ⚡ Fast response time 🔁 Flexible and powerful 🚀 JIT (Just-In-Time) compiler — works as both compiler and interpreter 🧠 Common Console Methods window.alert("Alert message"); console.log("Log message"); console.warn("Warning message"); console.info("Information message"); 📘 console: A built-in JS object giving access to the browser’s debugging console. 🧩 log(), warn(), info() are methods used to print messages or information. 🧱 Objects in JavaScript Objects are collections of properties and methods. Properties (fields): Store data like strings or numbers. Methods (functions): Perform actions. ⚠️ Common JavaScript Errors 1️⃣ Syntax Errors – mistakes in code structure 2️⃣ Reference Errors – using variables not defined 3️⃣ Type Errors – invalid operations on data types 🔡 JavaScript Variables – var, let, const Variables are used to store data values. There are three ways to declare them: var, let, and const 10000 Coders #Frontend #JavaScript #LearningNewThings #WebDevelopment #Coding #Programming
To view or add a comment, sign in
-
-
🍏 JS Daily Bite #10 — JavaScript Prototype Chains: A Full Comparison Master JavaScript's prototype-based inheritance system by exploring ways to create and manipulate prototype chains, their trade-offs, and best practices. 🏗️ Methods for Creating Prototype Chains: 1️⃣ Object Literal Syntax with __proto__ ✅ Standardized, optimized, more performant than Object.create() ✅ Ergonomic for declaring properties at creation ⚠️ Fails silently when pointing to non-objects 2️⃣ Constructor Functions ✅ Fast, standard, JIT-optimizable ⚠️ Methods are enumerable by default, inconsistent with class syntax ⚠️ Error-prone for longer inheritance chains 3️⃣ Object.create() ✅ Direct prototype setting at creation ✅ Can create objects with null prototype ⚠️ Verbose, error-prone, potentially slower than literals 4️⃣ Classes (ES6+) ✅ Ideal for complex inheritance with readability and maintainability ✅ Supports private elements ⚠️ Less optimized than traditional constructors 🔧 Mutating Existing Prototype Chains: 1️⃣ Object.setPrototypeOf() ✅ Modify the prototype of existing objects ⚠️ Can disrupt engine optimizations 💡 Best practice: set prototype during object creation 2️⃣ The __proto__ Accessor ⚠️ Fails silently with non-objects ⚠️ Non-standard and deprecated 💡 Recommendation: use Object.setPrototypeOf() instead ⚡ Performance Considerations: 1️⃣ Prototype Chain Lookup Costs Deep chains slow property access Non-existent properties traverse the entire chain All enumerable properties in the chain are iterated 2️⃣ Checking Own Properties Use hasOwnProperty() or Object.hasOwn() Don’t rely solely on undefined checks 🔜 Next in the Series: Enumerability and ownership of properties #JavaScript #JSDailyBite #WebDevelopment #Programming #LearnToCode #Prototypes #Inheritance #SoftwareEngineering #FrontendDevelopment #JSFundamentals #TechEducation
To view or add a comment, sign in
-
🚀 New Article: Understanding JavaScript Closures & Lexical Environments Ever wondered what really happens under the hood when JavaScript functions "remember" their variables? I just published a deep dive into closures—one of JavaScript's most powerful (and misunderstood) features. In this article, you'll learn: ✅ How Lexical Environments work behind the scenes ✅ Why functions remember where they were created ✅ The [[Environment]] property every function carries ✅ Memory management and garbage collection with closures ✅ A Chrome DevTools debugging gotcha that might surprise you Whether you're preparing for interviews or leveling up your JS knowledge, understanding closures is essential for writing better code. 🔗 Read the full article on DEV.to: https://lnkd.in/dfY2pJEQ #JavaScript #WebDevelopment #Programming #Closures #SoftwareEngineering #DevCommunity #CodingLife
To view or add a comment, sign in
-
Most beginners write messy if-else logic — pros don’t. In JavaScript, mastering conditional statements means writing logic that’s not just functional, but readable and scalable. This post breaks down every major pattern: 1. if / else / else if 2. switch 3. ternary operator 4. logical & short-circuit operators 5. optional chaining and nullish coalescing real-world validation and role-based logic Want to level up your JavaScript readability game? Share the worst if-else chain you’ve ever written. https://lnkd.in/dVuD2ZWq #JavaScript #WebDevelopment #CodingTips #FrontendDev #ProgrammingBasics #LearnToCode #Nextjs #MERNStack
To view or add a comment, sign in
-
🚀 Understanding Functions in JavaScript — The Building Blocks of Logic! While exploring JavaScript, I realized that functions are at the heart of writing clean, reusable, and organized code. They help us break down complex logic into smaller, manageable parts. Here’s a quick breakdown of different types of functions in JavaScript 👇 🟢 1. Function Declaration function greet() { console.log("Hello, World!"); } ✅ Hoisted — can be called before their definition. 🟣 2. Function Expression const greet = function() { console.log("Hello, World!"); }; ⚠️ Not hoisted — must be defined before use. 🔵 3. Arrow Function (ES6) const greet = () => console.log("Hello, World!"); 💡 Short, modern syntax — great for callbacks and concise logic. 🟠 4. Anonymous Function Used without a name, often inside event handlers or callbacks. setTimeout(function() { console.log("Executed after 2 seconds"); }, 2000); 🔴 5. Immediately Invoked Function Expression (IIFE) Runs immediately after it’s defined. (function() { console.log("IIFE executed!"); })(); Useful for creating isolated scopes. 🟢 6. Higher-Order Function A function that takes another function as an argument or returns one. function operate(a, b, callback) { return callback(a, b); } operate(2, 3, (x, y) => x + y); // Output: 5 🔁 Common in methods like .map(), .filter(), and .reduce(). ✨ Functions are like the brain of your JavaScript code — they decide how everything works together! 💬 What’s your favorite type of JavaScript function and why? Let’s discuss how each type fits into modern JS coding! #JavaScript #WebDevelopment #Frontend #Coding #Programming #LearningJourney
To view or add a comment, sign in
-
🍏 JS Daily Bite #7 🧬 JavaScript Inheritance: Understanding the Prototype Chain JavaScript's approach to inheritance is unique — and understanding it is key to mastering the language. 🚀 What is the Prototype Chain? JavaScript objects are dynamic collections of properties ("own properties"). But here's where it gets interesting: every object also has a link to a prototype object. When you try to access a property, JavaScript doesn't just look at the object itself — it searches up the prototype chain until it either finds the property or reaches the end of the chain. 🧩 🔑 Key Concepts to Know: [[Prototype]] is the internal link to an object's prototype, accessible via Object.getPrototypeOf() and Object.setPrototypeOf(). Don’t confuse obj.__proto__ with func.prototype — the latter specifies what prototype will be assigned to instances created by a constructor function. In object literals, you can use { __proto__: c } to set the prototype directly. 🧠 The “Methods” Twist: JavaScript doesn’t have methods in the traditional class-based sense. Functions are just properties that can be inherited like any other. And here's a critical detail: when an inherited function executes, this points to the inheriting object — not the prototype where the function is defined. ⚡ 💡 Why This Matters: Understanding prototypes is essential for working with JavaScript's object model, debugging inheritance issues, and leveraging modern class syntax (which is really just syntactic sugar over prototypes). 👉 Next up: Constructors — how JavaScript creates and links objects during instantiation! #JavaScript #JSDailyBite #WebDevelopment #Programming #FrontendDevelopment #SoftwareEngineering #LearnToCode #TechEducation #CodeNewbie #Developers #100DaysOfCode
To view or add a comment, sign in
-
Day 14/100 Day 5 of JavaScript Mastering Loops in JavaScript In JavaScript, loops are used to execute a block of code repeatedly — until a certain condition is met. They help reduce redundancy and make our code more efficient and clean. Let’s understand the main types of loops 🔹 1. for loop Used when you know how many times you want to repeat an action. for (let i = 1; i <= 5; i++) { console.log("Number:", i); } 🧠 Explanation: Here, the loop runs from i = 1 to i = 5. Each time, i increases by 1, printing numbers from 1 to 5. --- 🔹 2. while loop Used when you don’t know how many times the loop should run, but have a condition to check. let i = 1; while (i <= 5) { console.log("Count:", i); i++; } Explanation: This loop keeps running as long as i <= 5. Once i becomes 6, it stops. --- 🔹 3. do...while loop Runs the block at least once, even if the condition is false. let i = 1; do { console.log("Step:", i); i++; } while (i <= 5); --- Why Loops Matter: Avoid repetitive code Handle large datasets efficiently Control complex logic easily --- Pro Tip: Use the right loop for the right situation — for → fixed iterations while → condition-based repetition do...while → execute once before checking condition #10000coders
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