Thursday 15 March 2012

javascript - How to remove item from multidimensional object by value -


I need to extract items from a multi-functional JavaScript object. For example, I have this objecÅ ¥ tree (screenshot Only part in):

Enter image details here < P> I need to remove items with the value of "file", so for example on the screenshot, I need to remove the "9RuOxSPnTR-i_1.jpg" file from the tree.

I tried to use it:

  $ Each folders (index_file = file, numeric index key of the file, function (index_folder, folder) {// foreach files folders $ .each as .each (folders, functions (index_file, file_data) {// foreach files} ) Delete files [index_folder] [index_file];});});    

You use objects to remove properties and to remove elements of arrays : & gt; Var o = {a: 1, b: 2}; & Gt; Oye. Delete; True & gt; O; {B: 2} & gt; Var a = ['a', 'b', 'c', 'd']; & Gt; A.splice (2, 1); ['C'] & gt; a; ['A', 'B', 'D']

No comments:

Post a Comment