Why does Google add while(1); at the beginning of their JSON responses?
Hi everyone! I'm a beginner frontend developer, and recently I encountered an interesting feature when working with the Google API. When I make a request to some of their endpoints, for example, the Google Calendar API or Google Suggest, I see a strange construct in the response: `while(1);` before the JSON itself.
Here's an example of what the response looks like:
```
while(1);
{"items": [{"id": 1, "name": "test"}]}
```
At first, I thought it was some kind of error or bug. I tried to parse such a response using `JSON.parse()` — naturally, I got an error because `while(1);` is not valid JSON.
I had to write a workaround to trim this prefix:
```javascript
fetch('https://some-google-api.com/data')
.then(response => response.text())
.then(text => {
const json = text.replace(/^whil