๐Ÿ’Ž ROR ๐Ÿš‚ :๐Ÿ—‘๏ธ Garbage collection ๐Ÿšฎ

Garbage collection (GC) is a crucial aspect of memory management in programming languages, including Ruby on Rails. The primary purpose of garbage collection in Rails is to automatically reclaim memory that is no longer in use or referenced by the program. Here are some key reasons in details, why garbage collection is essential in Rails:

How to get query string values in JavaScript?

You can get query string values in JavaScript by using the URLSearchParams object. The URLSearchParams the object provides a convenient way to extract the query string from a URL and access the values of individual parameters. Here’s an example of using URLSearchParams to extract the query string from a URL and get the value of … Read more How to get query string values in JavaScript?

what is the return value of querySelectorAll and getElementsBy* and which is more preferred?

querySelectorAll and getElementsBy* are two methods used to select elements from the DOM (Document Object Model) in JavaScript. 1) querySelectorAll: The querySelectorAll method returns a non-live NodeList of all elements matching a CSS selector within the document. The returned NodeList is a static collection of elements and is not updated when the DOM is updated. … Read more what is the return value of querySelectorAll and getElementsBy* and which is more preferred?

The fastest way to duplicate an array in JavaScript

The fastest way to duplicate an array in JavaScript depends on the size of the array and the type of elements it contains. Here are three methods for duplicating an array in JavaScript: Using the slice method: Using the spread operator: Using Array.from: All three methods are speedy for small arrays with simple data types … Read more The fastest way to duplicate an array in JavaScript

Writing to files in Node.js with example

To write to a file in Node.js, you can use the built-in fs (file system) module. The fs module provides a variety of methods for working with the file system, including reading and writing files. Here’s an example of how you can write to a file in Node.js: In this example, we first require the … Read more Writing to files in Node.js with example

How to change Browser URL without reload page with multiple query params using javascript

You can change the browser URL without reloading the page by using the history.pushState() method in JavaScript. This method allows you to modify the URL in the address bar of the browser and add query parameters to it. Here’s an example: In this example, newURL is the new URL that you want to add to … Read more How to change Browser URL without reload page with multiple query params using javascript