We have multiple ways to write JavaScript commands.
There is 4 type of script writing sample.
Sample1: Inline HTML
JavaScript/002-HowToStartWriting/001-InlineCommand1
Sample2: Inline HTML – Multiple
JavaScript/002-HowToStartWriting/002-inlineCommand2
Sample3: In Head – Script Tag
JavaScript/002-HowToStartWriting/003-JavaScriptTagInHead
Sample4: External JavaScript File
JavaScript/002-HowToStartWriting/004-JavaScriptExternalFile