, , for (, ), , .
$.getJSON URL-, offlineName, offlineName . , . offlineName - "ESL_SC2", ajax URL-, , , - , .BUT wait offlineName "OgamingSC2"! , , , , "OgamingSC2" . , , , 1- 2- , , offlineName (noobs2ninjas), .
.. , , offlineName . - let URL offlineName, , ,
https://codepen.io/vsk/pen/LbNpBQ
, let , , , URL offlineName
(function(url,name) {
$.getJSON(url, function(data){
if (data.stream !== null){
currChannel = new Channel(data.stream.channel.display_name, data.stream.channel.status);
}
else {
currChannel = new Channel(name, "Offline");
}
outArr.push(currChannel);
});
})(URL,offlineName);
https://codepen.io/vsk/pen/rWeOGL
EDIT: ,
function hello(url,name){
}
hello(URL,offlineName);
, , , , ( № 39,53,54 ) . , .
, Java, JS ( VM) , hello, ( , ), ; (URL, offlineName); hello, , getJson , , " " , [1]. URL offlineName / , , [1], , . , JS ( )
- , , , getJson , , , VM . - - ( ), , , VM , , , , , , , - . , , , , loadStreams, hello, (- ).
, , " ", .
for loop --> hello() --> getJson inner function ( )
let, http://caniuse.com/#feat=let