Results 1 to 3 of 3

Thread: Array functions

  1. #1
    Ext User
    Join Date
    Jun 2009
    Posts
    21
    Vote Rating
    0
      0  

    Default Array functions

    clarification:
    old: Removes the specified object from the array.
    new: Removes THE FIRST OCCURRENCE OF the specified object from the array.

    also i dislike the signature of the method, but assume it's out of question to change that. (would prefer the return value to be either the removed object, or pos where -1 = none, or boolean).

    also i would like to have additional methods 3:
    • removeAll(obj)
    • Code:
      Array.prototype.removeRange = function(from, to) {
        var rest = this.slice((to || from) + 1 || this.length);
        this.length = from < 0 ? this.length + from : from;
        return this.push.apply(this, rest);
      };
    • with an alias for removePos to make it clear how to call it with just one param.

    ( Array Remove - By John Resig (MIT Licensed) http://ejohn.org/blog/javascript-array-remove/ )
    Last edited by mystix; 20 Jul 2009 at 5:55 AM. Reason: POST CODE IN [code][/code] TAGS. see http://extjs.com/forum/misc.php?do=bbcode#code

  2. #2
    Ext User
    Join Date
    Jun 2009
    Posts
    21
    Vote Rating
    0
      0  

    Default follow-up

    (and that it re-indexes the tail of the array)

  3. #3
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    8
      0  

    Default

    Moved your posts from Documentation Bugs thread to General Discussion forum.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •