5 posts tagged with "javascript"
![](/static/0103e4a2bc827bcf4bb40b49d50b909e/0132d/pexels-photo-681118.jpg)
Sorting an array of objects by a property value in javascript
Sorting using sort() Lets say that you have an array of objects that you wanted to sort by: You can use the sort() method of the Array that uses a callback function. The function takes 2 parameters in the array (commonly called a and b) When the callback function…
![](/static/5390194acd038c6f1a1a71f213979cab/2070e/pexels-kevin-ku-577585.jpg)
How to extend types in Typescript
When working with TypeScript, you’ll frequently encounter scenarios where you need to merge or enhance existing types to craft a new, specialized one. Fortunately, TypeScript makes this process straightforward and user-friendly. To extend a type in Typescript, you have…
![](/static/0ed754f553b134696a737bef068216e3/0132d/pexels-tirachard-kumtanom-733857.jpg)
Removing empty elements from an array
When dealing with tag inputs from users, I find myself having to make sure they they don’t enter in any blank or empty tags. Then I realized that I needed to find out how to remove undesirable elements not only from the Php side, but also from the Javascript side as…
![](/static/2ba7933b12ec9b431563d4312621d655/2070e/milan-degraeve-0ztvUdH5b-A-unsplash.jpg)
Remove Anchors from a Url in Javascript
Here is something useful that I discovered in my programming for my personal websites. I needed to strip out the anchor portion of a link and leave the rest of the url intact. For example I wanted: http://jelaniharris.com/I-love-apple-pies#comments To look like: http…
Adding a delay to JQuery Functions
Recently I was working on a few functions that I didn’t want to have activated immediately after hovered over a div. I neededthe functions to activate after a half a second of hovering by the user. To do this I created this this piece of code. Let’s go through line by…