javascript Logic Challenge #3 how to count the digits of a number in JS Simple Explanation : Imagine a number like 567. We want to know how many numbers are inside it. So we do this: 1. Take the number 2. Remove the last digit 3. Each time you remove a digit - count +1 4. Stop when the number becomes 0 That’s it! Example: 567 - 3 digits I used a simple loop that removes one digit at a time and counts it. #JavaScript #Learning #LogicBuilding
How to count digits in a number with JavaScript
More Relevant Posts
-
Math was simple… then JavaScript said: “hold my semicolon.” 😄 This meme perfectly highlights one of the most important JS fundamentals: 🔹 == → compares values (with type coercion) 🔹 === → compares value + type (strict, predictable) Example that surprises beginners: 0 == false → true 0 === false → false Rule I follow: Always prefer === unless you have a very specific reason not to. Mastering this early saves hours of debugging later. #JavaScript #CleanCode #WebDevelopment #ProgrammingHumor #LearningInPublic
To view or add a comment, sign in
-
-
Assalam o Alaikum, JavaScript Functions: Function Expressions & Arrow Functions. This lesson shows function expressions (const add = function(a,b) {…}), arrow functions (const add = (a,b) => a + b), implicit returns, and default parameters (name = "Guest"). Try addExpression, addArrow and greetWithDefault() in script.js and inspect results in DevTools Console. Watch the lesson: https://lnkd.in/djWwBZTv Follow DeveloperMaroof for concise, practical JS lessons. #JavaScript #Functions #FunctionExpressions #ArrowFunctions #DeveloperMaroof #WebDevelopment #LearnToCode #CodingTips
JavaScript Lesson 08 | Function Expressions & Arrow Functions | JavaScript Tutorial
https://www.youtube.com/
To view or add a comment, sign in
-
Day 3/30 – JavaScript Challenge 🚀 Built a Random Color Generator using JavaScript 🎨 On button click, it generates a random HEX color and updates the background dynamically. Concepts practiced: ✔ Math.random() ✔ Event handling ✔ DOM manipulation Learning by building, one day at a time. GitHub: https://lnkd.in/d7Yg96J4 #JavaScript #WebDevelopment #LearningInPublic #30DaysOfCode
To view or add a comment, sign in
-
-
Converting arrays to strings can be a tricky task, especially for beginners 📝. I recall my early days in JavaScript, struggling to turn object arrays into comma-separated strings. After some research, I discovered a few simple methods to achieve this. By utilizing JavaScript's built-in functions, you can easily convert arrays into strings with or without commas. Read more: https://lnkd.in/gb63R9N8 #JavaScript #ProgrammingTips #WebDevelopment
To view or add a comment, sign in
-
“Master JavaScript Arrays in One Visual! 🚀 From basics to advanced operations, this infographic covers everything you need to handle arrays like a pro — push, pop, loop, filter, map, reduce, and more. Perfect for beginners and anyone looking to refresh their JS skills. 💻✨ #JavaScript #Coding #WebDevelopment #ProgrammingTips #LearnToCode #JSArrays #DeveloperLife #TechLearning”
To view or add a comment, sign in
-
-
JavaScript breaking your “arrays must have same datatype” belief? You’re not alone — and there’s a clear reason behind it. I created a simple carousel explaining how JS handles types, memory, and arrays behind the scenes. Check it out and tell me: What’s one JS concept you wish you understood earlier? 👇 Thanks to Kumari Kritika for the design touch! #JavaScript #WebDevelopment #CodingBasics #LearnToCode #FrontendDevelopment #TechEducation #ProgrammingTips #DeveloperCommunity #CodeNewbie #SoftwareEngineering #Anupravi's LearningHubOfficial
To view or add a comment, sign in
-
Day 3/30 – JavaScript Challenge #30daysOfLeetCode Solved LeetCode: To Be Or Not To Be ✅ The solution implements a custom expect function that returns an object with two methods: toBe and notToBe. These methods compare values using strict equality (===) and throw meaningful errors when conditions fail. Closures are used to retain access to the initial value, enabling clean and readable test-like behavior without global variables. ✅ All test cases passed 📌 Learning how testing utilities work internally and strengthening JavaScript fundamentals On to the next problem 💪 #30DaysOfJavaScript #JavaScript #LeetCode #ProblemSolving #LearningInPublic #CodingJourney #WebDevelopment
To view or add a comment, sign in
-
-
Lecture 07 JavaScript Arrays Completed Today was all about arrays, and honestly-this lecture killed a lot of beginner misconceptions. Mentor: Rohit Negi Bhaiya. Covered Core methods: push, pop, splice Looping the right way (for vs for...of) Real-world methods: map, filter, reduce Mutating vs non-mutating methods Sorting, copying with spread, and finding elements The truth bomb: JS arrays are actually objects Big lesson: If you don't understand how arrays actually work, bugs are guaranteed. Slow progress, solid fundamentals. On to the next one #JavaScript #WebDevelopment #LearningInPublic #Frontend
To view or add a comment, sign in
-
-
Mastering JavaScript: The Power of .reduce(): The Array.reduce() method is a powerhouse in JavaScript, often hailed as the "Swiss Army Knife" for array transformations. While it might seem a bit intimidating at first glance, understanding its core principle can unlock a new level of efficiency and elegance in your code. Think of reduce as a data synthesizer: it takes an array of individual items and, through a "reducer" function, combines them step-by-step into a single, accumulated result. This could be a sum, an object, or even a flattened array! I recently tackled LeetCode Problem 2626: "Array Reduce Transformation," which challenged us to implement our own version of this fundamental method. Here's a clean, efficient solution: #JavaScript #WebDevelopment #CodingTips #FunctionalProgramming #JavaScript #LeetCode #WebDevelopment #CodingChallenge #SoftwareEngineering #ProgrammingTips #FrontendDevelopment #DataTransformation #TechSolutions
To view or add a comment, sign in
-
-
🔥 You don’t need to memorize every JavaScript trick. You need to understand the basics well enough to reason through problems. Strong fundamentals = faster learning, fewer bugs, more confidence. Save this. JavaScript will reward you later ⚡💻 #JavaScript #WebDevelopment #FrontendDev #LearnToCode #CodingTips #DevJourney #ProgrammingBasics
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
How about a one-liner? 🙃 const count = Math.abs(num).toString().length; Swathi Suresh great work, I love your daily quests