How to get client's IP address using JavaScript?

I was trying to use the cloudflare code to access client IP which is mentioned in below link.
Now I just wanted to understand, Is there any impact while using this? Like, restricted to number of visit/any chance of attack/Is this paid service, etc. Please help.

$.get('https://www.cloudflare.com/cdn-cgi/trace', function(data) {
  // Convert key-value pairs to JSON
  // https://stackoverflow.com/a/39284735/452587
  data = data.trim().split('\n').reduce(function(obj, pair) {
    pair = pair.split('=');
    return obj[pair[0]] = pair[1], obj;
  }, {});
  console.log(data);
});

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.