Let talk a bit about it evolution, Its first specifiction was written in 1997 then after 02 years they added many features such as the try/catch exception handling, regular expression and other new control statements, 10 years later in 2009 many features were added such as library sorpot for JSON the "strit mode" for more error filtering, setters, getters ..., and the major version(ES6) was published in 2015 with many paradim to mimic the Object Oriented Languages.
Add new HTML to the page, change the existing content, modify styles.
React to user actions, run on mouse clicks, pointer movements, key presses.
Get and set cookies, ask questions to the visitor, show messages.
Remember the data on the client-side (“local storage”).
This project has dramastically change the way modern application are build today as you can see on the picture bellow the list of some biggest tech company which are using it.
Modern tools make the transpilation very fast and transparent, actually allowing developers to code in another language and auto-converting it “under the hood”.
Amont those languages with can have:
TypeScript is concentrated on adding “strict data typing” to simplify the development and support of complex systems. It is developed by Microsoft.
(ES6) EmacScript-6 Syntax
Let asume that you have the above mentioned tools up and running. Open your text-editor and type the following code snippet and seved as
<!DOCTYPE HTML> <html> <head> <title>your title</title> </head> <body> <!--your html code here --> <script> alert( 'Hello, world!' ); </script> </body> </html>
let explain how this code is working. The interpreter scan the code till it reach the first script tag, it start by the first line within the tag and execute line after line. So, for our case here it found only one line
Save the file and open it with your browser,
As you may guest we have the
alert() keyword that has as function to display what was passed in it's parentases in our case
'Hello, World!' please go further and play with it by changing the value to what ever you want.
// Add your code here alert( 'Hello, world!' );
Once we done, we simply include the file into our html like the following line of code
/path/to/script.js is an absolute path to the file with the script (from the site root). It is also possible to provide a path relative to the current page.
src="script.js" would mean a file
"script.js" in the current folder.
We can give a full URL as well. For instance:
We can even attached several script, with multiple tags as follow:
<script src="/path/to/script1.js"></script> <script src="/path/to/script2.js"></script> <script src="/path/to/script3.js"></script>
srcis set, the script content is ignored. A single
<script>tag can’t have both the
srcattribute and the code inside. This won’t work:
<script src="file.js"> alert(15); // the content is ignored, because src is set </script>
We must choose: either it’s an external
<script src="…"> or a regular
<script> with code. The example above can be split into two scripts to work:
<script src="file.js"></script> <script> alert(15); </script>
Let end here and you should keep in your mind that the best way to learn programming is to by written code. So, use what you have learn today to display what ever text you can think :) and jumb to the next article when ready.
By receiving free stock articles and smart tutorials to advance your career...