cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to delete an element in an array using index?

former_member671720
Participant
0 Likes
1,175

Hi Experts,

we have a use case where we need to delete elements in an array and currently, we are using the splice() method to delete but we are getting this error saying that splice is not a function

the error we are getting is :

do we need to import any library to use the array functions? or are we doing anything wrong syntax-wise?

our use case is we have a string with us and we have an array of elements

ex: str = "TELANGANA";

states = ["TELANGANA","DELHI","ASSAM"];

we have to delete the str TELANGANA from the states array and after updating it should look like

states => [DELHI,ASSAM]

we also checked with remove/delete and getting the error,
how to delete the string element in an array?

whereas it's working fine in our browser console

but it is not working in CDC

Can you please help
Thanks
Kishore

Accepted Solutions (0)

Answers (0)