Getting list of fruits into array list var fruitList = [];
var fruitExpired = GetFruitStatus();
var fruitName = "Mango";
var companyName = "Limited";

if(fruitExpired)
{
   var expiredCrateId = GetExpiredCrate().ID;
   list.push({
    expiredCrate : expiredCrateId,
    fruitName : name,
    fruitCompany : companyName
   });
}
else
{
   var CrateId = GetCrate().ID;
   list.push({
    crateId : expiredCrateId,
    fruitName : name,
    fruitCompany : companyName
   });
}


Can I bring list.push outside if else ? this will help remove duplicate code, only difference is that if expired I am adding property  expiredCrate : expiredCrateId, otherwise  crateId : expiredCrateId,
You can create a fruit with the common properties before the if:

var fruitList = [];
var fruitExpired = GetFruitStatus();
var fruitName = "Mango";
var companyName = "Limited";

var fruit = {
    fruitName: name,
    fruitCompany: companyName
}

if (fruitExpired) {
    fruit.expiredCrate = GetExpiredCrate().ID;
} else {
    fruit.crateId = GetCrate().ID;
}

list.push(fruit);


Also, beware where you put { } in your code, it's not C# and a { after if or else should be on the same line.