Skip to content
This repository was archived by the owner on Oct 27, 2021. It is now read-only.

Commit 07682a1

Browse files
Create script.js
1 parent aa8159b commit 07682a1

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

script.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var subscriberCount = [],viewCount=[],commentCount=[],videoCount = [];
1+
var channelSubscriberCount = [], channelViewCount = [], channelCommentCount = [], channelVideoCount = [];
22

33
function getNewChannel(){
44
document.getElementById('display').innerHTML = '';
@@ -24,23 +24,23 @@ function channelsCountCode(channelId , i=0){
2424
async :false,
2525
success : function(data){
2626
var temp = data.items[0];
27-
subscriberCount[i] = temp.statistics.subscriberCount;
28-
viewCount[i] = temp.statistics.viewCount;
29-
commentCount[i] = temp.statistics.commentCount;
30-
videoCount[i] = temp.statistics.videoCount;
27+
channelSubscriberCount[i] = temp.statistics.subscriberCount;
28+
channelViewCount[i] = temp.statistics.viewCount;
29+
channelCommentCount[i] = temp.statistics.commentCount;
30+
channelVideoCount[i] = temp.statistics.videoCount;
3131
}
3232
});
3333
}
3434

35-
function displayChannelsCount(i){
35+
function displayChannelsCount(i = 0){
3636
$('#display').append('\
3737
<div id="channel'+channelId[i]+'">\
3838
<img src="'+channelThumbnail[i]+'">\
3939
<h1 id="'+channelTitle[i]+'" onClick="getNewChannel()">'+channelTitle[i]+'</h1>\
40-
<h2 id="'+channelId[i]+'">Subscribers : '+subscriberCount[i]+'</h2>\
41-
<h2 id="'+channelId[i]+'">Channel Views: '+viewCount[i]+'</h2>\
42-
<h2 id="'+channelId[i]+'">Videos : '+videoCount[i]+'</h2>\
43-
<h2 id="'+channelId[i]+'">Comments : '+commentCount[i]+'</h2>\
40+
<h2 id="'+channelId[i]+'subscribers">Subscribers : '+channelSubscriberCount[i]+'</h2>\
41+
<h2 id="'+channelId[i]+'views">Channel Views: '+channelViewCount[i]+'</h2>\
42+
<h2 id="'+channelId[i]+'videos">Videos : '+channelVideoCount[i]+'</h2>\
43+
<h2 id="'+channelId[i]+'comments">Comments : '+channelCommentCount[i]+'</h2>\
4444
</div>\
4545
');
4646
}

0 commit comments

Comments
 (0)