project. Please help to find error

after first call printStreamers str is empty, why?

First u have this logic in code:

if ( === null){
if ("game" in{

so u getting error when is === null, that game prop cannot be accessed in object that is null
On other side object that u want to refer is not null, it is undefined
so u may write like this:

if (!{

else if (“game” in{


Then u got empty string cause getJSON is async operation
U have here nice but on other side old explanation

Your console.log is happening before getJSON is done cause async mode
So u want to move your lines:

console.log('my string: ’ + str);

inside getJSON function

Also if u don’t want to your result concatenate, reset str every time u are in getJSON

Thanks, i did this job, but understend not everyone.