code have to do 3 things
- get json output of user.
- get user status on-line or off-line (if data.stream === null) user is off-line
- create user with nickname and status.
- push that user into array. lastData array
1st problem i get TypeError data.sream is null even if i define null as in examples. some people say`ed that i can just ignore that, but i want to ask professionals -- Pritam Banerjee answer this question thank you
2nd problem is that user is not pushed into array. only same user is pushed few times in array. Code is here Fiddle
sorry if question is not good but i dont know where else to ask.
var mynull = null;
if (typeof mynull === null) { // have to be if(mynull == null)
// my code
}
else
//my code
// building prototype name & status
function userStatus(name, status) {
this.name = name;
this.status = status;
} // prototype
var showUserList = ["OgamingSC2", "habathcx", "RobotCaleb", "noobs2ninjas"]
var lastData = []; // where to push users
for (var i = 0; i < showUserList.length; i++) {
var user = showUserList[i]; // get username from array
var useris = showUserList[i] // --//--
useris = new userStatus(user, 'Chanel is Offline');
lastData.push(useris);
console.log(lastData[i].name + '' + lastData[i].status);
}