栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

未捕获的SyntaxError:非法返回语句

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

未捕获的SyntaxError:非法返回语句

你不能返回,除非你在一个函数中

您可以将所有代码包装在IIFE中

(function() {    // your pre here}())

或者

if (window.top == window.self) {    if (document.readyState !== 'loading')        return console.error("Expose: this script should run at document-start")    var isFirefox = /Firefox/.test(navigator.userAgent)    // Stage 1: Find corresponding rule    var rules    for (var i = 0; i < allRules.length; i++)        if (allRules[i].hostname.indexOf(window.location.hostname) !== -1) { rules = allRules[i] break        }    if (!rules)        return console.error("Expose: cant find corresponding rule")    // Stage 2: Search for `main_out.js`    if (isFirefox) {        function bse_listener(e) { tryReplace(e.target, e) }        window.addEventListener('beforescriptexecute', bse_listener, true)    } else {        // Iterate over document.head child elements and look for `main_out.js`        for (var i = 0; i < document.head.childNodes.length; i++) if (tryReplace(document.head.childNodes[i]))     return        // If there are no desired element in document.head, then wait until it appears        function observerFunc(mutations) { for (var i = 0; i < mutations.length; i++) {     var addedNodes = mutations[i].addedNodes     for (var j = 0; j < addedNodes.length; j++)         if (tryReplace(addedNodes[j]))  return observer.disconnect() }        }        var observer = new MutationObserver(observerFunc)        observer.observe(document.head, {childList: true})    }}


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/608771.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号