Most JS serialization formats fall short—JSON breaks on circular refs, others need schemas or treat data as trees. Alexander Cheprasov introduces JSBT, a binary format built for JS object graphs, supporting Maps, Sets, BigInts & more—delivering massive size savings and faster data exchange #javascript #JavaScript #WebDev #Frontend #Backend #FullStack
Introducing JSBT: Efficient JavaScript Object Graph Serialization
More Relevant Posts
-
What is the difference between shallow copy and deep copy? Copying objects in JavaScript is not always what it seems. A `shallow copy` duplicates only the first level. Nested objects are still shared by reference. A `deep copy` duplicates everything recursively. Why did this happen? - The top-level object was copied - But `address` still points to the same reference To fully isolate data, a deep copy is required. Understanding this is critical when: - Managing state - Avoiding unintended mutations - Debugging shared data issues The behaviour is subtle — but the impact is everywhere. #Frontend #JavaScript #WebDevelopment #SoftwareEngineering
To view or add a comment, sign in
-
-
Day 22 #100DaysOfCode 💻 1. Difference between map and filter? — B. map transforms, filter selects 2. What triggers this? (addEventListener) — B. Button click 3. What happens here? (onclick) — B. Runs on click 4. What is the output? (map without return) — B. [undefined, undefined, undefined] 5. Which is correct to get input value? — B. value 6. What is the output? (array.find) — B. 2 7. What does async/await simplify? — B. Callbacks 8. What is the output? (array.filter) — B. [3, 4] 9. Which is best for spacing between flex items? — B. gap 10. What does querySelector do? — B. First match 11. Layout direction (Tailwind flex-col md:flex-row) — B. Column on small, row on medium+ 12. Why does map return undefined? — B. Missing return 13. What does JSON.stringify() do? — A. Converts object to string 14. What does Array.push() do? — A. Adds element to the end 15. What is the use of the spread operator (...) ? — C. Copying or merging arrays/objects 16. How to save data in LocalStorage? — B. setItem('key', 'value') 17. Difference between const and let — A. const cannot be reassigned 18. == vs === — B. === checks both value and type 19. What is the output of typeof null? — C. "object" 20. What is Hoisting? — A. Moving declarations to the top 21. Why is useState used in React? — B. To manage component state 22. What does p-4 mean in Tailwind? — A. Padding on all sides 23. What does Array.reduce() do? — B. Accumulate values to a single result 24. Why use event.preventDefault()? — A. Stops default browser behavior 25. Which method does fetch() use by default? — A. GET 🚀 #javascript #reactjs #webdevelopment #frontenddeveloper #coding #learninginpublic #Akbiplob
To view or add a comment, sign in
-
🧩 Demystifying the Node.js Event Loop: It's Not Just One Thread! Ever wondered what actually happens when you call setTimeout(() => {}, 1000)? Most people say "Node is single-threaded," but that’s only half the story. Here is the visual breakdown of how Node.js orchestrates asynchronous magic using libuv: 1. The Handoff (Main Thread) When you set a timer, the Main JS thread (V8) doesn't wait. It registers the callback and duration with libuv and moves on to the next line of code. 2. The Engine Room (libuv) This is where the heavy lifting happens. libuv maintains a Min-Heap—a highly efficient data structure that sorts timers by their expiration time. It puts the thread to "sleep" using OS-level polling (like epoll or kqueue) until the nearest timer is ready. 3. The Queue & The Tick Once the time arrives, libuv moves your callback into the Callback Queue. But it doesn't run yet! The Event Loop must cycle back to the "Timers Phase" to pick it up. ⚠️ The "Golden Rule" of Node.js Don't block the loop. If you run a heavy synchronous operation (like a massive while loop), the Event Loop gets stuck. Even if your timer has expired in the background, the Main Thread is too busy to check the queue. This is why a setTimeout(cb, 100) might actually take 5 seconds to fire if your main thread is congested. Key Takeaway: Node.js is fast because it offloads waiting to the OS via libuv, keeping the main thread free for execution. Keep your synchronous tasks light, and let the loop do its job! 🌀 #NodeJS #WebDevelopment #SoftwareEngineering #Backend #Javascript #ProgrammingTips
To view or add a comment, sign in
-
I just published a new open-source library: input-mask. I built it because input masking on the frontend often feels more annoying than it should be, especially in simple projects, forms, landing pages, and workflows where you just want to configure the field and move on. The idea is straightforward: apply input masks using HTML attributes only, without needing to write JavaScript just to initialize everything. You add the library via CDN, use attributes like data-mask="pattern" or data-mask="currency" on the input, and it handles the rest. Under the hood it uses IMask, but the whole point was to hide that complexity and make the implementation much more accessible. The first public version already supports: • pattern • regex • number • currency • date Repo: https://lnkd.in/e6pkj7wB CDN: https://lnkd.in/ebc7fdr5 If anyone wants to try it, share feedback, or suggest improvements, I’d love to hear it. #javascript #frontend #webdev #opensource #forms #nocode
To view or add a comment, sign in
-
If a function fires 1000 times, but you only want it to run every 100 calls, there's a neat technique for that. Today I learned about counter-based sampling in JavaScript. Use Cases • sampling analytics events to reduce load • limiting noisy logs or metrics • running expensive work periodically in high-frequency flows How it's different from throttling? Sampling is call-count based → run every N calls Throttling is time-based → run at most once every X ms So if 1000 events fire instantly: • sampling (every 100) → runs 10 times • throttling (200ms) → may run only once Different problems, different tools. #javascript #softwareengineering #frontend #webdevelopment #todayilearned
To view or add a comment, sign in
-
-
How JavaScript Memory Model Works: Stack vs Heap Allocation ? (1) Stack stores primitives and references – Fast, LIFO-structured memory for execution contexts, local variables, and primitive values, but limited in size. (2) Heap stores complex data – Larger, slower, unordered memory for objects, arrays, functions, and closures. (3) References connect stack to heap – Variables on the stack hold memory addresses (pointers) that reference data stored in the heap. (4) Primitives live directly on the stack – Values like numbers and strings (when small) are stored inline, while strings and complex types use heap references. (5) Functions are heap-stored with scope – Function bodies reside in the heap, while references and scope chains remain on the stack during execution. Test your JavaScript fundamentals with focused on scope, hoisting, closures, and asynchronous behavior. 💬 Share your answer or reasoning in the comments. #JavaScript #InterviewPreparation #SoftwareEngineering #WebDevelopment #DevelopersOfLinkedIn #frontend #backend #coding #learning
To view or add a comment, sign in
-
-
Day 10/100 of JavaScript 🚀 Today’s topic : Fetch API "fetch" is used to make HTTP requests in JavaScript and is a modern replacement for XMLHttpRequest Basic usage : fetch("https://lnkd.in/gCA7VyNQ") .then(res => res.json()) .then(data => console.log(data)) .catch(err => console.error(err)); Using async/await : async function getData() { try { const res = await fetch("https://lnkd.in/gCA7VyNQ"); const data = await res.json(); console.log(data); } catch (err) { console.error(err); } } What it does : - Returns a Promise - Cleaner than XMLHttpRequest - Works well with async/await #Day10 #JavaScript #100DaysOfCode
To view or add a comment, sign in
-
TypeScript's most powerful keyword that nobody understands. infer You've seen it in utility types. You've copy-pasted code that uses it. You've never fully understood what it does. It's simpler than you think: infer captures a type into a variable. Read it like this: type ArrayItem<T> = T extends (infer U)[] ? U : never "If T is an array of something, capture that something as U, then return U." That's it. Pattern matching for types. How to read any infer type: 1. Look at extends → that's the pattern 2. Find infer X → that's what gets captured 3. Look after ? → that's what you get back Real use cases: → Get item type from an array type Item = ArrayItem<User[]> // User → Get resolved value from Promise type Data = Unpromise<Promise<string>> // string → Get props from a React component type Props = ComponentProps<typeof Button> → Get return type from function type Result = ReturnType<typeof fetchUser> That last one? ReturnType is just infer under the hood: type ReturnType<T> = T extends (...args: any[]) => infer R ? R : never You've been using infer this whole time. Now you know how to write your own. #typescript #javascript #frontend #webdev #programming #webdevelopment #react #types #cleancode #devtips
To view or add a comment, sign in
-
-
Catching bugs at 2:00 PM but they don’t wake me up at 2:00 AM. 🛠️ Moving from #JavaScript to #TypeScript wasn’t just a syntax change; it was a shift in confidence. By defining our data structures upfront, we’ve effectively eliminated the "undefined is not a function" errors that used to haunt our production logs. The Difference: In JS, you pass an object and hope the property exists. In TS, the editor won't even let you save the file until you've handled the possibility of it being missing. Example: // JavaScript: The "Finger-Crossing" Method function getUsername(user) { return user.profile.name; // Runtime Error if profile is missing! } // TypeScript: The "Contract" Method interface User { profile?: { name: string }; } function getUsername(user: User) { return user.profile?.name ?? "Guest"; // Type-safe and explicit } The initial setup takes a few extra minutes, but the hours saved in debugging are immeasurable. Have you made the switch yet? Or are you still team Vanilla? 👇 #WebDevelopment #TypeScript #SoftwareEngineering #Coding
To view or add a comment, sign in
-
-
🚀 JSON vs JavaScript Object: Simple Breakdown! 🚀 Ever wondered what's the real difference? Check this visual! 👇 JavaScript Object 💻: Lives in memory, holds properties + functions (methods). Super flexible for your code! JSON 📄: Just text format for data sharing. No functions, strict rules – perfect for APIs & storage! JSON = Data transport. JS Object = In-app powerhouse! Dev friends, save this for your next API debug! What's your biggest JSON gotcha? Comment below! ⬇️ #WebDevelopment #JavaScript #JSON #Coding #Programming #Frontend #Developer #ReactJS #DevCommunity #LearnToCode #Innovation #Technology
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