Thursday, January 28, 2021

JavaScript to get index from a JSON object with value

 In modern browsers you can use findIndex:

But this function is not supported by even not so old versions of a few browser as well as in IE (EDGE supports it). So below is a workaround using javascript: You can use either Array.forEach or Array.find or Array.filter

This method takes little more overhead as it loops through the whole object to search for the match. So, for lengthy JSON data, this method is not suggested(even though it gets the work done).

Tuesday, January 5, 2021

Displaying a number in Indian format using JavaScript

Indian money format function