久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<legend id='lHxBt'><style id='lHxBt'><dir id='lHxBt'><q id='lHxBt'></q></dir></style></legend>
  • <i id='lHxBt'><tr id='lHxBt'><dt id='lHxBt'><q id='lHxBt'><span id='lHxBt'><b id='lHxBt'><form id='lHxBt'><ins id='lHxBt'></ins><ul id='lHxBt'></ul><sub id='lHxBt'></sub></form><legend id='lHxBt'></legend><bdo id='lHxBt'><pre id='lHxBt'><center id='lHxBt'></center></pre></bdo></b><th id='lHxBt'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='lHxBt'><tfoot id='lHxBt'></tfoot><dl id='lHxBt'><fieldset id='lHxBt'></fieldset></dl></div>

  • <tfoot id='lHxBt'></tfoot>

    <small id='lHxBt'></small><noframes id='lHxBt'>

    • <bdo id='lHxBt'></bdo><ul id='lHxBt'></ul>

      1. 我什么時候應該在 JavaScript 中使用 delete vs 將元素

        When should I use delete vs setting elements to null in JavaScript?(我什么時候應該在 JavaScript 中使用 delete vs 將元素設置為 null?)

                <small id='QvhXI'></small><noframes id='QvhXI'>

                  <tbody id='QvhXI'></tbody>

              • <tfoot id='QvhXI'></tfoot>
              • <legend id='QvhXI'><style id='QvhXI'><dir id='QvhXI'><q id='QvhXI'></q></dir></style></legend>
                • <bdo id='QvhXI'></bdo><ul id='QvhXI'></ul>
                  <i id='QvhXI'><tr id='QvhXI'><dt id='QvhXI'><q id='QvhXI'><span id='QvhXI'><b id='QvhXI'><form id='QvhXI'><ins id='QvhXI'></ins><ul id='QvhXI'></ul><sub id='QvhXI'></sub></form><legend id='QvhXI'></legend><bdo id='QvhXI'><pre id='QvhXI'><center id='QvhXI'></center></pre></bdo></b><th id='QvhXI'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='QvhXI'><tfoot id='QvhXI'></tfoot><dl id='QvhXI'><fieldset id='QvhXI'></fieldset></dl></div>
                  本文介紹了我什么時候應該在 JavaScript 中使用 delete vs 將元素設置為 null?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  可能重復:
                  在 JavaScript 中刪除對象

                  我有一個具有大量屬性的 JS 對象.如果我想強制瀏覽器垃圾收集這個對象,我需要將這些屬性中的每一個都設置為 null 還是需要使用 delete 運算符?兩者有什么區別?

                  I have a JS object having a large number of properties. If I want to force the browser to garbage collect this object, do I need to set each of these properties as null or do I need to use the delete operator? What's the difference between the two?

                  推薦答案

                  在 JavaScript 中沒有強制垃圾回收的方法,你也不需要這樣做.x.y = null;delete x.y; 都消除了 xy 之前值的引用.該值將在必要時被垃圾回收.

                  There is no way to force garbage collection in JavaScript, and you don't really need to. x.y = null; and delete x.y; both eliminate x's reference to the former value of y. The value will be garbage collected when necessary.

                  如果您將某個屬性設為空,它仍會被視為對象上的設置"并會被枚舉.我唯一能想到您希望在哪里delete 是如果您要枚舉 x 的屬性.

                  If you null out a property, it is still considered 'set' on the object and will be enumerated. The only time I can think of where you would prefer delete is if you were going to enumerate over the properties of x.

                  考慮以下幾點:

                  var foo = { 'a': 1, 'b': 2, 'c': 3 };
                  
                  console.log('Deleted a.');
                  delete foo.a
                  for (var key in foo)
                    console.log(key + ': ' + foo[key]);
                  
                  console.log('Nulled out b.');
                  foo['b'] = null;
                  for (var key in foo)
                    console.log(key + ': ' + foo[key]);
                  

                  此代碼將產生以下輸出:

                  This code will produce the following output:

                  Deleted a.
                  b: 2
                  c: 3
                  Nulled out b.
                  b: null
                  c: 3
                  

                  這篇關于我什么時候應該在 JavaScript 中使用 delete vs 將元素設置為 null?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調用完成)
                  JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                  XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標頭) - IT屋-程序員軟件開發技術分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內容)
                  Restrictions of XMLHttpRequest#39;s getResponseHeader()?(XMLHttpRequest 的 getResponseHeader() 的限制?)

                  <small id='SpuS7'></small><noframes id='SpuS7'>

                  <i id='SpuS7'><tr id='SpuS7'><dt id='SpuS7'><q id='SpuS7'><span id='SpuS7'><b id='SpuS7'><form id='SpuS7'><ins id='SpuS7'></ins><ul id='SpuS7'></ul><sub id='SpuS7'></sub></form><legend id='SpuS7'></legend><bdo id='SpuS7'><pre id='SpuS7'><center id='SpuS7'></center></pre></bdo></b><th id='SpuS7'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='SpuS7'><tfoot id='SpuS7'></tfoot><dl id='SpuS7'><fieldset id='SpuS7'></fieldset></dl></div>

                    <tbody id='SpuS7'></tbody>

                          <bdo id='SpuS7'></bdo><ul id='SpuS7'></ul>

                        • <tfoot id='SpuS7'></tfoot>
                          <legend id='SpuS7'><style id='SpuS7'><dir id='SpuS7'><q id='SpuS7'></q></dir></style></legend>
                          • 主站蜘蛛池模板: 国产乱码精品一区二区三区五月婷 | 一级黄色片在线免费观看 | 国产精品国产精品国产专区不蜜 | 欧美成人一区二区三区 | 国产成人在线免费 | 综合精品 | 国产免费黄网 | 亚洲成人黄色 | 日韩久草 | 日韩精品三区 | 91精品国产91久久久久久吃药 | 国产精品久久久久久久午夜片 | 免费在线观看一级毛片 | 日韩激情一区 | 欧美成人精品一区 | 色性av | 羞羞视频网站 | 国产精品爱久久久久久久 | 蜜桃官网 | 97av视频在线观看 | 久久亚洲一区二区三 | 久久久久久久亚洲精品 | 美女久久视频 | 成人性视频在线播放 | 日日操日日干 | 日日日日日日bbbbb视频 | 日韩欧美操| 免费观看色| 毛片入口 | 成年免费大片黄在线观看岛国 | 亚洲欧美视频 | 久久久久国产一区二区三区 | 亚洲免费片 | 国产精品污www一区二区三区 | h肉视频 | 午夜天堂精品久久久久 | av中文字幕在线 | 91免费版在线 | 在线色网| 国产精品亚洲精品 | 免费在线h视频 |