02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoPrevious Video

The Script Tag

<p> Before we start writing JavaScript we need to know where in the HTML code we will place the JavaScript code. There are three places where we can insert/write our JavaScript:</p> <ol> <li> <p> The <b>head section</b> can accommodate JavaScript as the head section of the HTML file loads before the body section. If you have a requirement where you need to run the JavaScript before the body loads, this is the only place for you: simply open and close the script tags &lt;script&gt; &lt;/script&gt; and write whatever JavaScript code needed between these tags.</p> </li> <li> <p> Anywhere in the <b>body</b> JavaScript can be used, with the same script tags as above.</p> </li> <li> <p> A <b>separate file</b>. Make a new text file and save it with whatever name you want, as long as the extension of the file is &ldquo;.js.&rdquo; You&#39;ll write all your Javascript code in this file.You will have two files now: one HTML and one .JS (JavaScript.). Now you must return to the head section of your HTML file and put in a HTML script tag that permits us link to other files and use their content. This is the same old &lt;script &gt; &lt;/script&gt;, but to tell the tag which file to link to, we include a parameter called source &ldquo;src.&rdquo; followed by the file name. And here it is: <b>&lt;script src=&rdquo;home.js&rdquo;&gt;&lt;/script&gt;</b>. We are telling the script tag that our JavaScript code is placed in a file named &quot;home.js&quot; (which must be located in the same folder as the HTML file, in this example) so link to that file and make the code available in the HTML file. When it loads the script tag&#39;s source parameter, it&#39;ll fetch the JavaScript code..</p> </li> </ol> <h3>What&#39;s recommended?</h3> <p> Which way should you go? The third way is highly recommended by the coding community. First of all it will keep all your JavaScript code in one file, making it easy to manage and change. Secondly it will not increase the HTML file code length, keeping it short and clean. Most importantly, the code will be reusable. For example, if you have two files which require the same JavaScript code, these two files can now share the same JavaScript file: and if you need to make a change in the JavaScript code, you only have to change it in that one file and it will be reflected everywhere.</p>

Intro

It's never been easier to start learning programming in JavaScript. We live in an HTML5 world: what would be better than learning how to code with JavaScript and HTML5?

03:59

The Script Tag

You must know about script tags in order to code in JavaScript, so let’s jump into it and learn with style!

04:26

OOP and DOM

Two basics which are very important in programming and provide discipline which helps you learn and stay organized

02:45

What are Variables?

Variables are the building blocks of any language, so it's best to be very familiar with them and their usage.

01:37

Strings

Strings are an important part of programming; they can be manipulated, passed as parameters and a lot more.

10:39

Creating Javascript Comments

Comments are a great asset of programming. They will help make the code more understandable and manageable

00:52

Numbers

Math is everywhere; numbers are everywhere. JavaScript lets us use them and apply math on them, so let’s have fun and learn about Numbers in JavaScript.

09:29

Boolean

Booleans help us make important decisions in programming by proving yes or no information.

09:10