Debugging Javascript in HTML that references external JS file

Very simple HTML with script tag to app.js. Why can I not call sum function from the app.js?

Thanks!

0
3 comments

similar app works fine for me. Please open Chrome dev tools console - what errors can you see there? Do you have any other projects opened? What web server is your app hosted on?

0
Avatar
Permanently deleted user

Ok, so I found the issue. SCRIPT type attribute value "javascript" is not valid option, even thou it is the first option that shows up in intellisense when type "type=" (until you select something else, than that becomes first value). Proper type value is:

type="application/javascript"

Even omitting the type works.

So, question becomes, why is javascript in the Intellisense list?

 

 

0

I'd say - for historical reasons. Actually anything can be specified as <script> type besides MIME types - different frameworks use this attribute to treat block content in a special way

0

Please sign in to leave a comment.