Code Fragments

1. Introduction

This document is a repository for miscellaneous snippets of code that haven't yet found their way into modules of the UIZE JavaScript Framwork.

2. Removing Values From An Array

function removeFromArray (_array,_value) {
  var _timesFound = 0;
  if (typeof _array != 'undefined' && _array != null && typeof _array.length == 'number') {
    for (var _elementNo = -1; ++_elementNo < _array.length - _timesFounds;) {
      if (_array [_elementNo + _timesFound] === _value) _timesFound++;
      if (_timesFound && _elementNo + _timesFound < _array.length)
        _array [_elementNo] = _array [_elementNo + _timesFound]
    }
    _array.length -= _timesFound;
  }
  return _timesFound;
}