<!DOCTYPE qhelp PUBLIC"-//Semmle//qhelp//EN""qhelp.dtd"><qhelp><overview><p>Elements of array literal expressions that are omitted will be initialized to <code>undefined</code>.However, such omitted elements are easy to miss and make code hard to read. They should be avoided.</p></overview><recommendation><p>Explicitly initialize the array elements to <code>undefined</code>. If you want to create an arraywith a specific number of uninitialized elements, use the <code>Array</code> constructor instead.</p></recommendation><example><p>The following code snippet initializes <code>a</code> to an array of size ten by using omittedelements.</p><sample src="examples/EmptyArrayInit.js" /><p>This code is clearly hard to read, and should be replaced by the following snippet:</p><sample src="examples/EmptyArrayInitGood.js" /></example><references><li>D. Crockford, <i>JavaScript: The Good Parts</i>, Appendix C.6. O'Reilly, 2008.</li></references></qhelp>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。