Day 51/100 – Consistency > Motivation Today I explored JavaScript Math Methods and how to convert numbers into integers using different approaches. Here’s what I learned: Math.round(x) – Rounds to the nearest integer Math.ceil(x) – Rounds up to the nearest integer Math.floor(x) – Rounds down to the nearest integer Math.trunc(x) – Returns the integer part of a number It’s interesting how small built-in methods can make a big difference in handling real-world data and calculations. Halfway through this journey, one thing is clear: Consistency builds confidence. No matter how small the topic seems, every day adds up. #100DaysOfCode #Day51 #JavaScript #WebDevelopment #LearningInPublic #Consistency
JavaScript Math Methods for Integer Conversion
More Relevant Posts
-
✨ 𝗗𝗮𝘆 𝟱 𝗼𝗳 𝗠𝘆 𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁 𝗝𝗼𝘂𝗿𝗻𝗲𝘆 🚀 Today I explored 𝗡𝘂𝗺𝗯𝗲𝗿𝘀 𝗮𝗻𝗱 𝘁𝗵𝗲 𝗠𝗮𝘁𝗵 𝗢𝗯𝗷𝗲𝗰𝘁 in JavaScript, and learned some interesting behind-the-scenes details: • 𝗡𝘂𝗺𝗯𝗲𝗿 – integers, floats, NaN, Infinity • 𝗠𝗮𝘁𝗵 𝗢𝗯𝗷𝗲𝗰𝘁 – handy methods like Math.round(), Math.floor(), Math.ceil(), Math.random(), Math.max(), Math.min() • 𝗠𝗮𝘁𝗵.𝗿𝗮𝗻𝗱𝗼𝗺() – generates pseudo-random numbers, which means it’s not truly random. It’s predictable if you know the algorithm and therefore shouldn’t be used for OTPs or secure codes. It’s fascinating to see how much thought goes into even simple math operations in JavaScript. Step by step, my fundamentals are getting stronger! 💪 #JavaScript #100DaysOfCode #WebDevelopment #LearningJourney #FrontendDevelopment #CodingTips
To view or add a comment, sign in
-
-
I just published a new blog post: "Understanding Variables and Data Types in JavaScript" ✍️ Every great application starts with the fundamentals. In this guide, I deep dive into: How variables act as containers for data. The differences between var, let, and const. Primitive data types and the concept of scope. A huge thank you to Hitesh Choudhary sir and the Chai Aur Code team for helping me build such a strong foundation in JS. Read the full article here: 🔗 https://lnkd.in/eEYXSV8a Piyush Garg | Akash Kadlag | Anirudh J. | Jay Kadlag | #JavaScript #WebDevelopment #ChaiAurCode #LearningJourney #Coding #Hashnode
To view or add a comment, sign in
-
-
✨ 𝗗𝗮𝘆 𝟰 𝗼𝗳 𝗟𝗲𝗮𝗿𝗻𝗶𝗻𝗴 𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁 🚀 Today I learned about 𝗖𝗼𝗻𝗱𝗶𝘁𝗶𝗼𝗻𝗮𝗹𝘀, 𝗟𝗼𝗼𝗽𝘀, 𝗮𝗻𝗱 𝗢𝗽𝗲𝗿𝗮𝘁𝗼𝗿𝘀 — the core logic that makes programs think and repeat tasks. But what really surprised me was what happens behind the scenes when we compare values. I discovered why floating-point calculations can be unpredictable in JavaScript. 𝗙𝗼𝗿 𝗲𝘅𝗮𝗺𝗽𝗹𝗲: 𝟬.𝟭 + 𝟬.𝟮 !== 𝟬.𝟯 This happens because JavaScript uses binary floating-point representation (IEEE 754), and some decimal numbers can’t be represented exactly in binary. So tiny precision errors appear. It’s fascinating to see that even simple math has deep computer science concepts behind it. Every day I realize: writing code is one thing, understanding it deeply is another. 💪 #JavaScript #100DaysOfCode #WebDevelopment #LearningJourney #ComputerScience
To view or add a comment, sign in
-
-
I just published a new blog post: "Understanding Objects in JavaScript" ✍️ Objects are one of the most fundamental parts of JS, allowing us to store complex data in structured key-value pairs. In this guide, I cover: What objects are and why we need them. Creating and accessing object properties. Updating, adding, and deleting data within objects. A huge thank you to Hitesh Choudhary sir and the Chai aur Code team for making these crucial concepts so clear and easy to follow. Read the full article here: 🔗 https://lnkd.in/eRDiPNWW #JavaScript #WebDevelopment #ChaiAurCode #LearningJourney #Coding #Hashnode
To view or add a comment, sign in
-
-
🚀 Day 20 of Learning in Public: JavaScript Edition 💻✨ Part-1 --Practice--Data Types--Coercion-- In Automation, data read from a website is always a String. If you don't handle this, your math logic breaks! Today I explored Type Conversion: ✅ Coercion: The silent bug where "50" + 10 becomes "5010". ✅ Explicit Conversion: Using Number() to ensure safe calculations. ✅ NaN: "Not a Number" - what happens when you try to do math on text. ✅ The Null Trap: Did you know typeof null is technically an object? 🤯 Code snippet 👇 ! #JavaScript #CodingJourney #LearningInPublic #NodeJS #TestAutomation #SDET #WebDevelopment #QualityAssurance
To view or add a comment, sign in
-
-
🚀 Cracked a tricky DSA concept today — Search in Rotated Sorted Array (with duplicates) At first glance the array looks unsorted… But actually it’s two sorted arrays joined together 🔍 Example: [2,5,6,0,0,1,2] The challenge ❓ Find a target efficiently (not O(n)) → Use Modified Binary Search (O(log n)) 💡 Key Learning: 1️⃣ One half of the array is always sorted 2️⃣ Check if target lies in the sorted half 3️⃣ If duplicates confuse the search → shrink the window (left++, right--) Core logic: • All equal → ignore edges • Left sorted → search there • Else → search right side 📈 What I learned: Understanding the logic is more important than memorizing code. Today I didn’t just solve a problem — I understood how to think like an algorithm. #DSA #BinarySearch #JavaScript #CodingJourney #100DaysOfCode #ProblemSolving
To view or add a comment, sign in
-
-
Is your JS copy a "Duplicate" or just a "Shortcut"? 👯♂️ Updating a "new" object only to see the original change too? That's a Shallow Copy bug. In JavaScript, objects are stored by reference. If you don't copy them correctly, you're just sharing memory. The Quick Fix: 📂 Shallow ({...obj}): Copies the surface. Nested objects stay linked. Use for flat data. 🏗️ Deep (structuredClone): Copies everything. Completely independent. Use for complex data. Stop using JSON.parse hacks. 🛑 I’ve broken down the memory mechanics and real-world "Ghost Mutation" fixes in my latest blog. Read the 2-minute deep dive: 👉 [https://lnkd.in/gzeT3rYw] #JavaScript #CleanCode #WebDev #Programming
To view or add a comment, sign in
-
-
Day 17/30: Binary Tree Back in the zone. Today I moved from linear sets to Binary Trees, bridging the gap between abstract DSA and the DOM. Key Takeaways: The Binary Constraint: Every node must have 0 or 2 children—simplicity through strict rules. The BST Rule: Left < Parent < Right. This order is what makes searching efficient. Recursion & Null: An empty tree (null) isn't a bug; it's the base case that gives recursion its "stop" signal. Logic is just a set of constraints that reduce cognitive load. #LearningInPublic #JavaScript #DSA #CleanCode #Trees
To view or add a comment, sign in
-
-
JavaScript Quiz: Hoisting vs. The Dead Zone! 💀 Think you know how variables work in JS? This snippet usually catches people off guard! 🧐 We’re comparing the "old school" var with the modern let. They might look similar, but the way the JavaScript engine treats them before the code even runs is totally different. The Question: What will be the output for line 1 and line 4? The Logic Check: -> Does var behave the same as let when called early? -> What on earth is a Temporal Dead Zone? 🖐️🛑 -> Will the code crash or just print undefined? Drop your guess below! 👇 A) undefined and undefined B) undefined and ReferenceError C) 10 and 20 D) ReferenceError and ReferenceError #JSQuiz #WebDev #CodingLife #SoftwareEngineering #JavaScriptTips #TechCommunity
To view or add a comment, sign in
-
-
🚀 Day 8 :-JavaScript & DSA Fundamentals 🌳 Understanding the Prototype Chain Root level: Object.prototype Then: Array.prototype, Function.prototype, String.prototype Learning how inheritance works using: Object.create(obj1) This helped me truly understand prototype-based inheritance in JavaScript. ⚙️ Mastering Functions in Different Ways Function declarations Function expressions Arrow functions Parameters vs Arguments Spread vs Rest operators Understanding how this behaves differently in arrow functions was a big insight. 🔁 Control Flow & Logic Building if / else / nested if for / while / do while switch statements Nested loops Variable scope (global, local, block) Why avoiding var prevents scope-related bugs 🧠 Deep DSA Practice I spent an entire day solving: Search in Rotated Sorted Array in complete day i create logic only above problem but i learn a lot from this problem to understanding about binary search in depth #JavaScript #DSA #WebDevelopment #LearningInPublic #ProblemSolving #FrontendDeveloper
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