Skip to content
Advertisement

Passing IP address isn’t working in a Function, unless I explicitly mention it

I’m trying to find the Country name for the given IP address using the ‘GeoIP2-City.mmdb’ file.

Ex: IP: 24.171.221.56, I need to get ‘Puerto Rico’. But this isn’t working when I passed the IP address in a function.

JavaScript

However, If I use the actual IP address in the function it is returning ‘Puerto Rico’

JavaScript

Can someone help with this?

Advertisement

Answer

You can try the following code snippet.

Code:

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement