DAY 3 of me reading random docs and here what I got to learn today ........ BigInt in JavaScript (a living legend)🫡 Standard Javascript numbers are double-precision floats, meaning they hit a limit at Number.MAX_SAFE_INTEGER (2^53 -1). BigInts completely bypass this ceiling, allowing us to represent integers as large as system memory allows. Means literally they have not defined any limit....... but still there is engine limit means how big any object can be is defined by js engine like v8 but that too is quite large ..... JavaScript strictly prevents mixing BigInt and standard Number types in arithmetic. 10n + 5 Throws a TypeError 10n + 5n Works perfectly This isn't a bug it's a feature to prevent accidental precision loss when truncating a massive integer into a float. #JavaScript #WebDevelopment #Coding #LearningEveryday #BigInt #FrontendDev
JavaScript BigInt: Large Integers Beyond Number.MAX_SAFE_INTEGER
More Relevant Posts
-
T, my language that transpiles to JavaScript, introduces the '//' (root) operator. It implements for '**' exactly the same symmetry that exists between multiplication ('*') vs division ('/'): Raising something to the xth power ('**x') vs taking the xth root of something (i.e. raising it to the reciprocal of that root). It's quite baffling to me that -- unless I missed something -- no other language has such an operator and one is instead stuck writing reciprocals all the time. Or awkward functions like `Math.sqrt` for special cases like the square root. #t #javascript #math
To view or add a comment, sign in
-
-
1. Two Sum (#LeetCode – Easy) Today I revisited one of the most popular DSA problems: Two Sum. The goal is simple—find two indices in an array whose values add up to a given target but the key is doing it efficiently. * Approach: I used a hash map to store previously seen numbers and their indices. For each element: - Calculate its complement (target - current number) - Check if the complement already exists in the map - If yes, return both indices immediately - This reduces the time complexity from O(n²) to O(n) * Why this works well: - Single pass through the array - Efficient lookup using Map - Clean and readable logic #LeetCode #JavaScript #DSA #ProblemSolving #CodingPractice #SoftwareEngineering #LearningEveryDay
To view or add a comment, sign in
-
-
SPREAD OPERATOR IN JS Just like its name suggests, the spread operator (...) spreads values — but why was it introduced? Before this, copying arrays, merging data, or passing multiple values into functions required verbose methods like loops or Object.assign(). Code was longer, harder to read, and easier to mess up. The spread operator was created to solve this: - Immutability – Create new arrays/objects without changing originals - Cleaner syntax – No more unnecessary loops or methods - Better readability – Your intent is instantly clear - Functional style – Works perfectly with modern JS patterns In short: It exists to make JavaScript code simpler, safer, and more expressive. Small feature. Big impact. #JavaScript #WebDev #Programming #CleanCode
To view or add a comment, sign in
-
-
🔥 Day 26 of #30DaysOfJavaScript #LeetCode 2705: Compact Object Today I worked on a really interesting problem — building a recursive function that removes all falsy values from an object or array, including deeply nested ones. Falsy values include: false, 0, "", null, undefined, NaN The twist? 👉 Arrays are also treated as objects 👉 And we must compact every nested level 👉 Without using any built-in magic ✨ 🧠 Key Learnings ✅ Recursion is perfect for tree-like structures ✅ Array.isArray() helps treat arrays differently ✅ Boolean(value) is a clean way to test truthiness ✅ JSON constraints simplify the problem #JavaScript #LeetCode #30DaysOfCode #WebDevelopment #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
T, my elegant, minimalist language that transpiles to JavaScript, does away with the weird old '&&' and '||' logical operator convention, and replaces them with '&' and '|'. If you REALLY need bit-wise operations (i.e. for the 3 cases in a lifetime where you do bit manipulation in a high-level language), T has a set of explicitly prefixed 'bit' operations for that. Less confusion, less typing, more logic! #t #javascript #compiler #programminglanguage #languagedesign #code
To view or add a comment, sign in
-
-
🍁 Covered Session 64 | Core JS Concepts Covered throttling and debouncing and focused on the real difference between them: 🖱️ Debouncing runs a function only after the event stops (useful for search inputs). 🖱️ Throttling runs a function at fixed intervals (useful for scroll or resize events). Also revised JSON.parse() and JSON.stringify() to understand how JavaScript objects are converted to strings and back, which is essential for APIs, localStorage, and data transfer. Straightforward concepts, but very important for performance and real-world applications. Sheryians Coding School #JavaScript #Frontend #WebDevelopment #Performance #JSON #LearningJS #Cohort2
To view or add a comment, sign in
-
🚀 Day 876 of #900DaysOfCode ✨ The 8 Most Useful Math Object Methods in JavaScript The JavaScript Math object is packed with powerful utilities — and knowing the right ones can save you time, simplify your logic, and make your code cleaner and smarter. In today’s post, I’ve highlighted 8 extremely useful Math methods that every JavaScript developer should know. They’re explained in a simple, practical, and easy-to-remember way so you can apply them instantly in your projects. If you want to level up your JS fundamentals, this post is a must-read. 👇 Which Math method do you use the most? Share in the comments! #Day876 #learningoftheday #900daysofcodingchallenge #FrontendDevelopment #WebDevelopment #JavaScript #React #CodingCommunity #MathObject
To view or add a comment, sign in
-
1. Parsing: First, the engine breaks down the code into tokens. Tokens are small units like keywords, operators, literals, and identifiers. Then, it parses the tokens to create an Abstract Syntax Tree (AST), which represents the grammatical structure of the code. Compilation: Modern JavaScript engines like V8 (used in Chrome and Node.js) use a technique called Just-In-Time (JIT) compilation. This involves compiling JavaScript code into machine code at runtime. 2. Execution: This is when we see the effects of our code in the browser. Initially, the engine interprets the JavaScript code directly from the AST, converting it into bytecode, which is then executed by the JavaScript Virtual Machine (JVM). The JIT compiler profiles the running code to identify “hot” code paths that are executed frequently. These paths are recompiled into highly optimized machine code for faster execution. 3. Garbage Collection: The engine performs memory management through garbage collection. It periodically scans for and cleans up unused or unreachable memory to free up resources. 4. Event Loop: Since JavaScript is single-threaded, it uses the event loop to manage the execution of asynchronous code. It continuously checks the call stack, and the message queue processes events and executes callback functions when the call stack is empty. #JavaScript, #WebDevelopment, #SoftwareDeveloper, #FrontendDeveloper, #FullStackDeveloper ,#Programming, #Coding ,#Tech, #DeveloperCommunity
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
-
-
🛑 𝐀 𝐝𝐞𝐞𝐩 𝐝𝐢𝐯𝐞 𝐢𝐧𝐭𝐨 𝐒𝐲𝐦𝐛𝐨𝐥𝐬 𝐥𝐞𝐝 𝐦𝐞 𝐭𝐨 𝐚 𝐬𝐮𝐫𝐩𝐫𝐢𝐬𝐢𝐧𝐠 𝐫𝐞𝐚𝐥𝐢𝐬𝐚𝐭𝐢𝐨𝐧 𝐚𝐛𝐨𝐮𝐭 𝐃𝐚𝐭𝐚 𝐏𝐞𝐫𝐬𝐢𝐬𝐭𝐞𝐧𝐜𝐞. I was digging into JavaScript core concepts recently and went down a rabbit hole with 𝐒𝐲𝐦𝐛𝐨𝐥𝐬 🌀. The concept is simple: a Symbol is a unique primitive. Even if you give two Symbols the same description, they are never equal. Symbol('id') === Symbol('id') // false 𝐓𝐡𝐞 𝐠𝐞𝐚𝐫𝐬 𝐢𝐦𝐦𝐞𝐝𝐢𝐚𝐭𝐞𝐥𝐲 𝐬𝐭𝐚𝐫𝐭𝐞𝐝 𝐭𝐮𝐫𝐧𝐢𝐧𝐠. ⚙️ For a moment, I wondered why we rely on UUID libraries at all when JavaScript already gives us guaranteed uniqueness. 🤔 That question turned out to be more educational than the answer. It felt like I’d found a massive shortcut ⚡. But the more I deep-dived, the more the "simple" shortcut started to fall apart. I hit three major reality checks: 1. 𝐓𝐡𝐞 "𝐌𝐞𝐦𝐨𝐫𝐲" 𝐏𝐫𝐨𝐛𝐥𝐞𝐦: Symbols are volatile. They live in your RAM 🧠, not your database 💾. If you restart your server, that Symbol "identity" is gone forever. You can't query a database for a key that literally doesn't exist anymore. 2. 𝐓𝐡𝐞 "𝐕𝐚𝐧𝐢𝐬𝐡𝐢𝐧𝐠" 𝐀𝐜𝐭: If you try to JSON.stringify() an object with a Symbol, it gets skipped. This is great for hiding internal metadata, but it’s a disaster if you’re trying to send a Product ID to a frontend 👻. 3. 𝐈𝐝𝐞𝐧𝐭𝐢𝐭𝐲 𝐯𝐬. 𝐕𝐚𝐥𝐮𝐞: I realized Symbols are for 𝐑𝐮𝐧𝐭𝐢𝐦𝐞 𝐀𝐫𝐜𝐡𝐢𝐭𝐞𝐜𝐭𝐮𝐫𝐞 (preventing name clashes in your code), while UUIDs are for 𝐃𝐚𝐭𝐚 𝐏𝐞𝐫𝐬𝐢𝐬𝐭𝐞𝐧𝐜𝐞 (identifying a row in a table across time) 🕰️. It was a great reminder that just because a tool provides "uniqueness" doesn't mean it’s meant for long-term storage. It’s easy to learn how a feature works, but the real work is learning where it actually belongs. 🗺️ 𝐀𝐧𝐲 𝐨𝐭𝐡𝐞𝐫 "𝐬𝐢𝐦𝐩𝐥𝐞" 𝐉𝐒 𝐟𝐞𝐚𝐭𝐮𝐫𝐞𝐬 𝐞𝐯𝐞𝐫 𝐥𝐞𝐚𝐝 𝐲𝐨𝐮 𝐝𝐨𝐰𝐧 𝐚 𝐫𝐚𝐛𝐛𝐢𝐭 𝐡𝐨𝐥𝐞? 𝐋𝐞𝐭’𝐬 𝐬𝐰𝐚𝐩 𝐬𝐭𝐨𝐫𝐢𝐞𝐬 𝐢𝐧 𝐭𝐡𝐞 𝐜𝐨𝐦𝐦𝐞𝐧𝐭𝐬. 👇 #JavaScript #Coding #WebDevelopment #Programming #TechDeepDive #SoftwareEngineering #JavaScriptSymbols #FrontendDevelopment #DevCommunity #LearnToCode
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