Founder Of Geekstrick. Full-Time Software Developer, Expertise in Frontend Development. Conversant with - Angular, React, NodeJS, and MongoDB, MySQL, Postgres,HTML+CSS+JS, CypressIO.

How to place an element in an array from one place to another?

geekstrick on January 8, 2022 🔥 501 views

Consider the array [‘one’, ‘two’, ‘four’, ‘three’] and we want to arrange the last two element. /** * move element one place to other in existing array * @param {any[]} arr: array Value * @param {number} from: index of value that need to be moved * @param {number} to: index where need to be placed […]


Create Library In Angular 12 – Search Highlighter

geekstrick on September 20, 2021 🔥 4706 views

In this tutorial, we will see how to Create a Library In Angular 12. Search Highlighter is what we are going to create throughout this article. If you are not aware of what is an angular library – Basically library is created to use some piece of code or you can say functionality to various […]


How to get properties indicated by given selectors from an object?

geekstrick on September 7, 2021 🔥 372 views

Consider an object from which we want to retrive properties. const obj = { earth: { level: { one: ‘soft mud and rocks’ } }, vibrations: [1, 2, { range: ‘medium’ }], }; Use […].map() for each selector, “vibrations[2].range”.replace() to replace square brackets with dots. Use “”.split(‘.’) to split each selector. Use […].filter() to remove […]


How to parse cookies in javascript?

geekstrick on September 6, 2021 🔥 8593 views

In the browser cookies is store in string format containing key-value pairs. So, how to parse a browser Cookie string and return an object of all cookie name-value pairs? separate each key-value pair using String.prototype.split(‘;’) Use and String.prototype.split(‘=’) to separate keys from values in each pair. Use Array.prototype.reduce() and decodeURIComponent() to create an object […]


How to use for loops to break out early in javascript?

geekstrick on September 3, 2021 🔥 507 views

for loop in modern JavaScript is rarely talked about although it’s only useful in asynchronous operation scenarios. But what breaking out early consider the following example: Matching two array const smallArray = [0, 2]; const largeArray = Array.from({ length: 1000 }, (_, i) => i); const areEqual = (a, b) => { let result = […]


How to create a cookie using JavaScript?

geekstrick on September 3, 2021 🔥 724 views

The simplest way to create a cookie is to assign a string value to the document.cookie object, for example- document.cookie = “key1 = value1; key2 = value2; expires = date”; // Example var now = new Date(); now.setTime(now.getTime() + 1 * 3600 * 1000); //set cookies to expire in 1 hour document.cookie = `${key} = […]


How to write a callback function in javascript?

geekstrick on September 2, 2021 🔥 406 views

A callback function is a function that is passed to another function as an argument and is executed after some operation has been completed. for example of a simple callback function that logs to the console after some operations have been completed. function extendArray(arr, callback) { arr.push(100); // then execute the callback function that was […]


SQL Update

geekstrick on May 28, 2021 🔥 515 views

SQL Null Values

geekstrick on May 28, 2021 🔥 437 views

The SQL NULL value means a field with no value present in it. What is a SQL NULL Value? If a field in a table is optional in other words if it’s not mandatory, it is possible to insert a new record or update a record without adding a value to this field. Then, the […]


SQL Insert Into

geekstrick on May 26, 2021 🔥 593 views

The SQL INSERT INTO statement is used to insert new records in a table. SQL INSERT INTO Statement There are two possible ways to insert data into the table using The INSERT INTO statement. Syntax Specifying both the column names and the values to be inserted: INSERT INTO table_name (column_1, column_2, column_3) VALUES (value_1, value_2, […]

1 2 3 20