title: Callback function ajax, JS
body: <pre><code>const getData = (method, url, print) =&gt; {
      const ajax = new XMLHttpRequest();
      
      ajax.open(method, url)
      ajax.send();
  
      ajax.onload = function(){
          const result = JSON.parse(ajax.responseText)
          print(result)
      }
  }
  
  const print = () =&gt; {
      result.map((item) =&gt; {
          console.log(item.title)
      })
  }
  
  
  getData('GET', 'http://jsonplaceholder.typicode.com/posts', print)
  </code></pre>
  <p>but the output is, &quot;ReferenceError: XMLHttpRequest is not defined&quot;
  can someone help me? Thank you</p>