index.html throwing an error in Chrome DevTools

我只是一个虾纸丫 提交于 2020-01-25 07:25:09

问题


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?".

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

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

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. I tried refreshing and saving but nothing.

my index.html with error

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. I assume this has to be due to the index.html file not working properly.

Anybody know what I'm doing wrong?

来源:https://stackoverflow.com/questions/59121329/index-html-throwing-an-error-in-chrome-devtools

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!