Today is day 2 of the #I4G10DaysOfCodeChallenge and the challenge for today was to remove a specific element from an array or list.
I solved the challenge using python and JavaScript.
I used the inbuilt remove method for python and the inbuilt splice method for JavaScript.
I looped through each content of the array and did a check to know if the specific number was reached, if it was then it should be removed from the array.
The splice method of JavaScript can be used if you are aware of the value you wish to delete from an array. You must first determine the target item's index. Then, you start by removing one element while using the index as the start element. To avoid skipping the next member in the array when you wish to remove many elements, simply decrement the index variable.
Thank you.
Top comments (4)
Congratulations! Keep going.
Thank you so much
Doings! 🤲🏾
Good simple solve!