JavaScript in a separeate file glitch? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

JavaScript in a separeate file glitch?

I'm using Brackets for my JavaScript course and when I create separate .js file with alert("Hello, World!"); , include it in the main .html file I get this error: 'alert' was used before it was defined. What am I doing wrong?

21st Jul 2019, 8:50 PM
da_dev
1 Answer
- 1
Try this in first line var alert; And after that alert('something');
21st Jul 2019, 11:50 PM
Yazan Alnughnugh
Yazan Alnughnugh - avatar