Any idea on how to splice table row from a array within a array?
'gl' =>
array (
0 =>
array(
'data1' => 1
'data2' => 1
'data3' => 1
'gl2'=>
array(
data1 => 1
data2 => 2
data3 => 3
)
)
)
and this is my splice function
function splice(data1,data2){
var gl_data = gl.find(g => {
return g.data1== data1
})
var found = gl_data.gl2.find(c => {
return c.data2== data2
})
if (found) {
var index = gl_data.gl2.indexOf(found)
gl_data.gl2.splice(index, 1)
}
}
it will prompt an error in my console TypeError: Cannot read property 'gl2' of undefined.. any idea?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire