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

3

Do that :

testObj.x = []

Hope it helped

Lka
  • 399
  • 5
1

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

testObj.x.length = 0;
fxtrot
  • 120
  • 10