Rehmaanali

Rehmaanali

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 get properties indicated by given selectors from an object?

geekstrick on September 7, 2021 🔥 968 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 “earth.level.one”.split(‘.’) to split each selector. Use […].filter() to remove […]

snippets

How to parse cookies in javascript?

geekstrick on September 6, 2021 🔥 35678 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 Array.prototype.map() and String.prototype.split(‘=’) to separate keys from values in each pair. Use Array.prototype.reduce() and decodeURIComponent() to create an object […]

snippets

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

geekstrick on September 3, 2021 🔥 1285 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 = […]

snippets

How to create a cookie using JavaScript?

geekstrick on September 3, 2021 🔥 1965 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} = […]

snippets

How to write a callback function in javascript?

geekstrick on September 2, 2021 🔥 1461 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 […]

snippets

Easily Translate Angular 12 App Using ngx-translate

geekstrick on May 24, 2021 🔥 120641 views

Code and Demo This tutorial will see how we can Easily Translate the Angular 12 App Using the library Angular 12 with ngx-translate The internationalization (i18n) library for Angular ngx-translate: It is an internationalization library for Angular. It will let you define translations for your content in different languages and you can switch languages easily. […]

post

Answer for replaceAll is not a function JavaScript Error

geekstrick on May 20, 2021 🔥 0 views

You can do it via regular expression: use the /g (“match globally”) modifier with a regular expression argument to replace if you are assigning a RegExp directly let a = “[email protected]”; a = a.replace(/xxxx-/g, “”); if you want to pass RegExp with some variable let a = “[email protected]”; const code = ‘xxxx’; const key = […]

discussion

Answer for What is difference between AngularJS and Angular?

geekstrick on May 18, 2021 🔥 0 views

Yes, Angular JS is a JavaScript framework it was used to develop a web application.     Angular JSThis framework has a model-view-controller (MVC) that acts as the central component as it manages data, logic, rules, and expresses how the applications behave.    AngularAngular uses components that are directives with templates. There are two kinds of […]

discussion

Angular v12 Is Now Released And Available

geekstrick on May 13, 2021 🔥 7032 views

Angular team has announced that the Angular v12 Is Now Released And Available. Below mention are the changes you will find in a newer version of angular. Angular v12: Ivy Everywhere Angular v12 has finally deprecated the View Engine. The community has been working over recent releases towards the goal of converging the Angular ecosystem […]

news

Flask 2.0 – New Major Version Released

geekstrick on May 12, 2021 🔥 10119 views

Flask 2.0 – New Major Version Released. This release will contain some new features such as some shorthand properties for the route, Support async views, callbacks such as error handlers, and better CLI errors. Flask 2.0 Upgradation and Installation Install from PyPI with pip. For example, for Flask: pip install -U Flask Note: Flask 2.0 […]

news