i want to create variable base on conditional, but even simple code i can not get the new variable this is my code
exports.productPatch = (req, res, next) => {
const id = req.params.productId;
const image = req.body.productImage;
if(image){
const newImage = image;
}else{
const newImage = "1598173461682-636126917.jpg";
}
console.log(newImage);
}
but when i call newImage response is not defined