简体   繁体   English

控制台无法从ATOM运行我的Javascript代码吗? **初学者

[英]Console won't run my Javascript code from ATOM? **Beginner

I am trying to run the code from ATOM to my console and has an error that I don't understand and won't show the function. 我正在尝试将代码从ATOM运行到控制台,并且出现了我不理解并且不会显示该功能的错误。

The code is written the exact same way as the code in my class (3rd screen). 该代码的编写方式与我班上的代码完全相同(第三个屏幕)。

[index image][1]
[JS image][2]
[Console Image][3]
[Image of instructor screen][4]

[1]: https://i.stack.imgur.com/EFZiL.png
[2]: https://i.stack.imgur.com/SvoJT.png
[3]: https://i.stack.imgur.com/pCjX6.png
[4]: https://i.stack.imgur.com/J26PQ.png

You are not including your Javascript file in your html. 您没有在HTML中包含Javascript文件。 In order for the code you have written to be executed when you open the index.html file in your browser, the javascript needs to be included. 为了在浏览器中打开index.html文件时执行您编写的代码,需要包含javascript。 To include a javascript file add a <script> tag in your <head> . 要包含JavaScript文件,请在<head>添加<script>标记。

<script src='/js/myJavascriptFile.js'></script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM