Saturday, January 12, 2019

Is JavaScript's array.clear() not a function?




I'm trying to empty an array containing my drawn coordinates when a button "clear" is pressed.




When I call drawnDivs.clear(), I get an error that it is not a function. drawnDivs is certainly an array, and I have Firebug console.logs printing things out. It's hosted here.


Answer



Nope, it's not. But drawnDivs.length = 0 should work.


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...