Got an Error 800A03EA in javascript

Got an Error 800A03EA in javascript


Hi Everyone,

I am a beginner in Java script programming. Although I have done a lot of program in HTML. I wrote my first JavaScript program in note pad and saved as first.js in note pad and opened the program in internet explorer.
I got an error as compilation error in line 1, char 1, syntax error, code -800A03EA and I have searched in google but unable to resolve this issue. Can anyone help me to go through this. My program is

<script type="text/javascript">
  alert('hello world!');



I’ve edited your post for readability. When you enter a code block into the forum, remember to precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.


The code you posted is your first.js file?


yes and I want to know why this error ? is there any problem with my coding or anything else. Can you help me ?


This is HTML code and you put it in a JS file. There’s your problem :slight_smile: The part inside <script> is the code that goes in the .js file


rename the file to first.html - html files should not have the .js extension - make sure you have the complete filename visible in Windows Explorer - this is done by unchecking the “Hide extensions for known file types” option in Folder Options:View

IE gives the error because it tries the run the entire file as a jscript file - which it is not

hopefully you got the page to load after renaming the file - here’s a few tips on your html so far

always start your html file with the doctype declaration - it should be the very first thing on the very first line of the file

<!doctype html>

Any text content that you want shown on the web page must be somewhere inside the <body> element - don’t put any text for display in the <head> element - browsers will still show the misplaced text after moving it to inside <body>

the <head> element is not a heading for the page - use the <h1> tag inside <body> like this


there was a time when the type attribute for <script> had some use - that time is no longer - just use the following for javascript

alert("hello world!")


Thanks ppc.
I got that it will run if i will change the extension name to html.But can you please tell me what should be program code for the same in javascript ?


If you’re asking what should be the filename for javascript the answer is the filename can be anything - typically it should have the .js extension but it’s not required - the filename is referenced in the html with the src attribute of an empty <script> tag

<!-- first.html -->
<script src=first.js></script>
// first.js
alert("hello world!")

you can mix javascript with html using <script> tags as you did - there is no need to make a separate javascript file in the beginning


This is so cool, I never knew that before :open_mouth: Now I can use crazy things as an extension


Thanks a lot
I could make it now.


Thanks alot Sangeeta and PPC i am also getting same error, Finaly i got Solution in FreeCodeCamp.