You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function getGithubInfo(username) {
var url = 'https://api.github.com/users/' + username;
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('GET', url, false);
xmlhttp.send();
return xmlhttp;
}
returns the xmlhttp object. I would argue that this is bad practice and the function should return only the data or a signifier of failure, for example throwing an error. The reason I think this is bad practice is that it as a function should only give data, and should not let its functionality "leak out" (sorry I am struggling to describe this well).
Am I willing to fix
Yes, I just wanted to know if people agreed with me first :)
The text was updated successfully, but these errors were encountered:
Where
The tutorial https://github.com/codebar/tutorials/blob/gh-pages/js/lesson4/tutorial.md
What
The code block
returns the xmlhttp object. I would argue that this is bad practice and the function should return only the data or a signifier of failure, for example throwing an error. The reason I think this is bad practice is that it as a function should only give data, and should not let its functionality "leak out" (sorry I am struggling to describe this well).
Am I willing to fix
Yes, I just wanted to know if people agreed with me first :)
The text was updated successfully, but these errors were encountered: