0

How do set array x to empty ?

var testObj = {
    x : ['1', '2'],
    y : ['1' , '3']
}

To Replace

var testObj = {
    x : [],
    y : ['1' , '3']
}

2 Answers2

1

Do that :

testObj.x = []

Hope it helped

Lka
  • 394
  • 1
  • 7
0

If you don't want to reassign the variable, you can also

testObj.x.length = 0;