when i put
for(let i=0; i<this.allVideoSubject.length; i++) {
for(let j=0; j<this.all.length; j++) {
if(this.all[j].subjectId !== this.allVideoSubject[i].vdoSub_id) {
//this.vdoSub_id_check[i] = true;
this.paidVideo.push({"subjectId":this.all[j].subjectId,"subjectName":this.allVideoSubject[i].vdoSub_name});
console.log(JSON.stringify(this.paidVideo))
}
}
}
when i put !== into the if like this
if(this.all[j].subjectId !== this.allVideoSubject[i].vdoSub_id)
its push same value many time why?
below my push array after checking
[{"subjectId":"1","subjectName":"Art & Design"},{"subjectId":"2","subjectName":"Comedy"},{"subjectId":"4","subjectName":"java"},{"subjectId":"2","subjectName":"Art & Design"},{"subjectId":"4","subjectName":"Art & Design"},{"subjectId":"4","subjectName":"Comedy"},{"subjectId":"1","subjectName":"Comedy"},{"subjectId":"2","subjectName":"Music"},{"subjectId":"4","subjectName":"Music"},{"subjectId":"1","subjectName":"Music"},{"subjectId":"2","subjectName":"java"},{"subjectId":"1","subjectName":"java"},{"subjectId":"2","subjectName":"XYZA"},{"subjectId":"4","subjectName":"XYZA"},{"subjectId":"1","subjectName":"XYZA"}]
how can i fix that
please help me out anyone