Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
67 views
in Technique[技术] by (71.8m points)

javascript - index.html在Chrome DevTools中引发错误(index.html throwing an error in Chrome DevTools)

I am following along with this Udemy course on "Advanced JavaScript", currently reviewing Scopes and watching the video " 9. What is an IIFE and why might you use it?".

(我正在跟着有关“高级JavaScript”的Udemy课程一起学习 ,目前正在阅读Scopes并观看视频“ 9.什么是IIFE,为什么要使用它?”。)

The instructor is using Chrome DevTools to show JS examples, and created the following three snippets - main.js , other.js , index.html

(讲师正在使用Chrome DevTools显示JS示例,并创建了以下三个片段-main.jsother.jsindex.html)

The instructor is trying to show that running main.js will print out:

(指导者试图证明正在运行的main.js将输出:)

main: Object{hello: "main"}

other: Object{hello: "other"}

For some reason my index.html file that I'm creating in Chrome DevTools has an error (x) on line 1. I have it saved as "index.html" and following along exactly, so not sure why the doc isn't being recognized as html.

(出于某种原因,我在Chrome DevTools中创建的index.html文件在第1行出现错误(x)。我将其另存为“ index.html”,并且按照以下步骤操作,因此不确定为什么文档不正确被识别为html。)

I tried refreshing and saving but nothing.

(我尝试刷新并保存,但是什么也没有。)

my index.html with error

(我的index.html错误)

Semi-related, I tried to run main.js with other.js and index.html written out and saved, but main.js only prints out < main >{hello: "main"} >, not the other.js object as well.

(半相关,我尝试运行main.js并写出并保存了other.js和index.html,但main.js仅打印出<main> {hello:“ main”}>,而不打印出other.js对象为好。)

I assume this has to be due to the index.html file not working properly.

(我认为这必须归因于index.html文件无法正常工作。)

Anybody know what I'm doing wrong?

(有人知道我在做什么错吗?)

  ask by longoria translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...