To complete freecodecamp’s “twitchTv” project, I write some code. I found that below type of code gives output ‘rana’ and “https://static-cdn.jtvnw.net/jtv_user_pictures/freecodecamp-profile_image-d9514f2df0962329-300x300.png” . I think it should give url first.If I comment out first window.alert (inside the function) then gives output only ‘rana’ . I think this variable should give the url of the logo. I do not know why this happens and how to solve the problem.
In success callback function the variable gets the value , but when I want to use it later (outside the function) , the variable gives me previous value ‘Rana’ ;