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

可以啟用“嚴(yán)格模式";在 FireBug 和 Chrome 的控

Possible to enable quot;strict modequot; in FireBug and Chrome#39;s console?(可以啟用“嚴(yán)格模式;在 FireBug 和 Chrome 的控制臺(tái)中?)
本文介紹了可以啟用“嚴(yán)格模式";在 FireBug 和 Chrome 的控制臺(tái)中?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

有了這個(gè)頁(yè)面:

<!DOCTYPE html>
<html>
  <head>
    <script>
        "use strict";
        var foo = 2;
        delete foo;
    </script>
  </head>
  <body></body>
</html>

Firebug 控制臺(tái)給出:

Firebug console gives:

applying the 'delete' operator to an unqualified name is deprecated
>>> foo
ReferenceError: foo is not defined
foo

但是這樣就成功了:

>>> var bar = 2;
undefined
>>> delete bar;
true

即使您注釋掉 delete foo; 以便腳本不會(huì)中斷,刪除 bar 仍然是成功的,盡管它是全局對(duì)象的屬性"因?yàn)樗峭ㄟ^(guò)變量聲明創(chuàng)建的,所以 DontDelete 屬性":

Even if you comment out delete foo; so that the script does not break, deleting bar is still successful despite the fact it "is a property of a Global object as it is created via variable declaration and so has DontDelete attribute":

>>> foo
2
>>> delete foo
false
>>> var bar = 2;
undefined
>>> delete bar
true

是否可以在 FireBug 和/或 Chrome 的控制臺(tái)中啟用嚴(yán)格模式"?

Is it possible to enable "strict mode" in FireBug and or Chrome's console?

推薦答案

firebug 控制臺(tái)通過(guò)將所有代碼包裝在eval"調(diào)用中來(lái)工作,因此腳本中的第一條語(yǔ)句不再是use strict" - 因此它是禁用.您可以嘗試將代碼包裝在一個(gè)函數(shù)中以對(duì)該特定函數(shù)強(qiáng)制使用嚴(yán)格",但我所知道的最佳解決方案是跳過(guò)控制臺(tái)并直接在頁(yè)面本身中進(jìn)行測(cè)試.

The firebug console works by wrapping all the code in an "eval" call so the first statement in your script is no longer "use strict" - hence it is disabled. You could try wrapping your code in a function to enforce "use strict" for that particular function but the best solution I know of is to skip the console and test straight in the page itself.

這篇關(guān)于可以啟用“嚴(yán)格模式";在 FireBug 和 Chrome 的控制臺(tái)中?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

How to fix BrowserWindow is not a constructor error when creating child window in Electron renderer process(在 Electron 渲染器進(jìn)程中創(chuàng)建子窗口時(shí)如何修復(fù) BrowserWindow 不是構(gòu)造函數(shù)錯(cuò)誤) - IT屋-程序員軟件開發(fā)技術(shù)
mainWindow.loadURL(quot;https://localhost:3000/quot;) show white screen on Electron app(mainWindow.loadURL(https://localhost:3000/) 在 Electron 應(yīng)用程序上顯示白屏)
Electron webContents executeJavaScript : Cannot execute script on second on loadURL(Electron webContents executeJavaScript:無(wú)法在第二個(gè) loadURL 上執(zhí)行腳本)
how to use electron browser window inside components in angular-cli?(如何在angular-cli的組件內(nèi)使用電子瀏覽器窗口?)
ElectronJS - sharing redux store between windows?(ElectronJS - 在 Windows 之間共享 redux 存儲(chǔ)?)
How to access camera/webcamera inside electron app?(如何在電子應(yīng)用程序中訪問(wèn)相機(jī)/網(wǎng)絡(luò)攝像頭?)
主站蜘蛛池模板: 精品少妇一区二区三区在线播放 | 亚洲综合区 | 日韩成年人视频在线 | 婷婷在线网站 | 日韩欧美专区 | 97精品久久| 亚洲一区久久 | 日本一区二区高清不卡 | 99在线观看视频 | 欧美日韩不卡 | 在线一区二区国产 | 欧美日韩在线精品 | 婷婷在线免费 | 美女国内精品自产拍在线播放 | 黄色成人国产 | 久热国产精品视频 | 国产精品综合色区在线观看 | 欧美一级二级在线观看 | 久久久久久国产 | 日日操av | 久草成人 | 国产一区二区三区在线 | 日韩精品一区二区三区在线播放 | 久久精品国产一区二区电影 | 91社区在线观看播放 | 在线视频第一页 | 欧美视频一区二区三区 | 午夜免费观看 | 欧美日韩精品专区 | 一区二区三区四区在线视频 | 日韩免费av网站 | 国产一区二区三区色淫影院 | 欧美激情一区二区三区 | 日一区二区 | 欧美aaaaa| 亚洲日本乱码在线观看 | 盗摄精品av一区二区三区 | 日韩网| 韩国精品一区二区三区 | 九一精品| 欧美视频在线看 |