Often when a language just evolves over the years, it go in a direction which would never had occurred if the language was developed from scratch. Such is the case of JavaScript and 'splice' being used for a delete. When can a 'splice' become a delete? We all know what the word 'splice' means and what it implies. However, in the case of JavaScript is has become a delete.
- var myArray = [1, 2 , 3]; // [1, 2, 3]
- myArray.splice(1,1); // [1, 3]
The word splice has now become a delete and see to be a pretty common practice in the JavaScript community.
No comments:
Post a Comment