β¨ 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.
ββββββ
ββββββ
#JavaScript #Programming
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.
ββββββ
ββββββ
#JavaScript #Algorithm
Please open Telegram to view this post
VIEW IN TELEGRAM
π8β€7π€―1
ββββββ
ββββββ
#JavaScript #computerScience
Please open Telegram to view this post
VIEW IN TELEGRAM
π13β€5
const counter = new Signal.State(0);
// Read the value of Signal
console.log(counter.get()); // Output: 0
// Change the value of Signal
counter.set(1);
console.log(counter.get()); // Output: 1
ref in VueJS, understanding Signals should pose no challenge.ββββββ
ββββββ
#JavaScript #EcmaScript
Please open Telegram to view this post
VIEW IN TELEGRAM
π8β€4π€―2