CodePen: Unable to log http GET call response in console

I’m not sure if this is the right forum to be asking this question. I’m using CodePen to test a practice http GET call. I’m logging the response to the console, however, the response isn’t displaying in the console (of the CodePen editor). I tested the URL endpoint in Postman and there is a response. Can someone shed some light on why I’m not seeing the response in the CodePen console? Here is the pen Thanks.

Since you are using an arrow function for your request.onload, this.response will be undefined as this will correspond to the window. Just use regular function syntax and you will get the results you seek.

1 Like

Ah. That worked, I wasn’t sure if it was something in the codepen app. I started to write it function () {... }, but since I’m learning the ES6, I tried the arrow, forgetting about how it works within nested object methods. Thank you @RandellDawson your answer led me find an article here on FCC I’d like to share for further understanding of the this keyword in arrow functions.