# HTTP response headers in AJAX in JavaScript

The response headers are stored in the `headers` property of the `response` object. Let's retrieve some header:

`button.addEventListener('click', function() { fetch('/ajax.html').then(response => { console.log(response.headers.get('Content-Type')); }); });`

And now let's go through all the headers in a loop:

`button.addEventListener('click', function() { fetch('/ajax.html').then(response => { for (let [key, value] of response.headers) { console.log(key, value); } }); });`

Get a content of the `Content-Language` header.

Get a content of the `Content-Length` header.

← →
↑
en ru