Are javascript arrays initialized to 0 explicit?

I need a typed array, in particular Float32Array, of all zeros. I thought that I would have to clean it manually, but I noticed that when I announced this, it was already reset. Is this something that is specified in the specification? Can I rely on this behavior?

+5
source share
2 answers

According to the Typed Array JavaScript Specification, content is initialized to 0 . Therefore, you should be able to rely on this behavior.

Keep in mind that typed arrays do not yet have very good cross browser support . Chrome, Safari, Firefox, and Opera support it, but Internet Explorer only introduces support in IE10.

, Safari . , , , Safari. , undefined.

+5

null, . null == 0, 0 . , , .toString. , , ​​ parseInt.

, , , JS...

-4

All Articles