Something to note is that you can transform some impure functions into pure ones by delaying evaluation

var pureHttpCall = function (url, params){  
  return function() {
      return $.getJSON(url, params); 
  };
};

We don't actually make the HTTP call - we instead return a function that will do so when called.

This function is pure because it will always return the same output given the same input: the function that will make the particular http call given the url and params.

Source.