Delete from array in javascript
<p>3 hours ago, I asked a question in SO , about delete a part  o an object that i liked this question to it.</p>

<p><a href="http://stackoverflow.com/questions/9359774/how-to-remove-a-part-of-an-object-in-javascript">delete a part of object in javascript</a></p>

<p>but now an other problem occurred when i delete from that array.
I use that object to populate a FlexiGrid. but when i delete an item from that object by following code, instead of delete that item , it sets to undefined :( and flexigrid did not accept it for input data.</p>

<pre><code>for (var i = 0; i &lt; Roomdata.length; i++) {

    if(Roomdata[i].id = X) {

        delete Roomdata[i];
        break;

    }
}                
</code></pre>

<p>for example , imaging i have 3 items in Roomdata like this : </p>

<pre><code>{item1, item2, item3}
</code></pre>

<p>when call this code to delete item2 , Roomdata object is look like this : </p>

<pre><code>{item1, undefined, item3}
</code></pre>

<p>and this is bad format to be acceptable by flexigrid as input data</p>

<p>It there any solution ?</p>

<p>thanks every body and sorry about my bad syntax(I am new in English)</p>

<p>regard , Foroughi</p>
