I have an object like below. Sometimes it will contain status sometimes not. I want to convert status value format into Number when it in object.
var obj={
name: 'abc',
status: '1',
updated_time: {
'$gt': 2019-11-03T00:00:00.000Z,
'$lt': 2019-11-03T15:23:55.838Z
}
}
i've tried as below but it's not converted;
if(obj.status){
parseInt(obj.status)
}
console.log("$$$$$$$$$$$$$$$$",obj)
console.log print
$$$$$$$$$$$$$$$${ name: 'abc', status: '1', updated_time: { '$gt': 2019-11-03T00:00:00.000Z, '$lt': 2019-11-03T15:23:55.838Z } }
parseIntreturns the converted value. You are not storing it anywhere.