while iam using the += operator the multiplication results in NaN
convertToDecimal(){
let current=this.head;
let size=this.size;
size-=1;
var result;
while(current!=null){
let num=current.value;
var power=Math.pow(2,size)
result=(power*num);
size-=1;
current=current.next;
}
// console.log(result);
}
**console without putting += for result
value of result in each iteration
8
4
2
1
but afer i puts +=
result+=(power*num);
output is
NaN
NaN
NaN
NaN
Anyone can explain this please, I am new to javaScript so may be its a dumb question