function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Timmy AhluwaliaTimmy Ahluwalia 

Splice method gives error.

In the below code I am trying to remove the element from the array, the splice method is failing for some reason.
 // this.productId =  {
    //     [
    //         {
    //             "Id": "a001700000802ZJAAY",
    //             "Name": "Medium Pizza",
    //             "Price__c": 9
    //         },
    //         {
    //             "Id": "a0017000007ztMUAAY",
    //             "Name": "Large Pizza",
    //             "Price__c": 10
    //         }
    //     ]
    // }
    
    handleDeleteSelected(event){
        console.log('handle Delete', JSON.stringify(event.detail))
    //    handle Delete {"Id":"a001700000802ZJAAY","Name":"Medium Pizza","Price__c":9}
        var del = event.detail.Id
        const productIndex = this.productId.findIndex(e => e.Id === del);
         const productupdate = this.productId;
  // delete the Medium Pizza from the productupdate array
        productupdate.splice(productIndex, 1)
       
      console.log('productIndex', productIndex)
        
      console.log(productupdate)
    }
Naveen KNNaveen KN
can you mention the error details
Timmy AhluwaliaTimmy Ahluwalia
The cose is failing at  
    productupdate.splice(productIndex, 1)
Error