Just started javascript couple a days ago. Both those function outputs the same. So, what's the difference between them?
First Method:
function fakeAjax(url,cb) {
setTimeout(function fakeLoadingDelay(){
cb([
"A Song of Ice and Fire",
"The Great Gatsby",
"Crime & Punishment",
"Great Expectations",
"You Don't Know JS"
]);
},500);
}
Second Method:
function fakeAjax(url,cb) {
setTimeout(cb([
"A Song of Ice and Fire",
"The Great Gatsby",
"Crime & Punishment",
"Great Expectations",
"You Don't Know JS"
])
,500);
}
Thanks a lot in advance.