Dev Dastan
324 subscribers
49 photos
2 videos
41 links
πŸ”Έ Programming Tips and Concepts πŸ‘Ύ

πŸ”ΉContact: @Hossein13M 🀘🏻
Download Telegram
✨ Object.freeze vs Object.seal in JavaScript


❓ Object.seal prevents adding and/or removing properties from the sealed object and makes every existing property non-configurable.

❓ Object.freeze does Exactly what Object.seal do, plus It prevents modifying any existing properties.


❗️ There are Object.isFrozen() and Object.isSealed() methods to check if an object is frozen or sealed.


βž–βž–βž–βž–βž–βž–
πŸ“Έ Image Credit: [here]
πŸ“– Stack Overflow Answer: [here]
βž–βž–βž–βž–βž–βž–
#JavaScript #Programming


πŸ–₯ Follow @devDastan for more content.
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘15❀9😎3🍌1
✨ JavaScript's Garbage Collection

ℹ️ The garbage collector in JavaScript is responsible for reclaiming memory occupied by objects that are no longer needed. This mechanism is done using mark-and-sweep algorithm.

ℹ️ The mark-and-sweep algorithm consists of two main phases:

1️⃣Marking: Garbage collector marks reachable objects from the global object, ensuring none are left unmarked if reachable from a rooted object.

2️⃣ Sweeping: Garbage collector reclaims memory from unmarked objects, freeing it up for future use.


πŸ“• Learn more about the JS's garbage collector's mechanism and best practices on the Medium I have written.


βž–βž–βž–βž–βž–βž–
πŸ“šArticle (Written by me!): [here]
βž–βž–βž–βž–βž–βž–
#JavaScript #Algorithm


πŸ–₯ Follow @devDastan for more content.
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘8❀7🀯1