issue96:programmation_javascript
                Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| issue96:programmation_javascript [2015/05/07 11:26] – auntiee | issue96:programmation_javascript [2015/05/22 15:31] (Version actuelle) – andre_domenech | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | You could ask why I chose to present JavaScript in this series of articles. The response is simple, JavaScript is the most trending and the most significant growth language in the past few years; there are very many open source projects which are using it, and you can find a lot of tutorials and guides on the Internet to learn it. Nowadays, you can develop anything in JavaScript; it does not matter if we are talking about web pages, single page applications (SPA), mobile applications for Android, iOS and Windows Phone, or IoT (http:// | + | ===== 1 ===== | 
| + | |||
| + | **You could ask why I chose to present JavaScript in this series of articles. The response is simple, JavaScript is the most trending and the most significant growth language in the past few years; there are very many open source projects which are using it, and you can find a lot of tutorials and guides on the Internet to learn it. Nowadays, you can develop anything in JavaScript; it does not matter if we are talking about web pages, single page applications (SPA), mobile applications for Android, iOS and Windows Phone, or IoT (http:// | ||
| It is well known that JavaScript (usually) runs in the browser, but not only. Through the years, each browser had its own JavaScript engine and runtime; there was no standard for the language which the browsers could implement. In many cases, the difference was not only in the JavaScript engine, but in other functions of the browsers, like how these displayed content on the page, how was the styling applied, and so on. Because of these differences, | It is well known that JavaScript (usually) runs in the browser, but not only. Through the years, each browser had its own JavaScript engine and runtime; there was no standard for the language which the browsers could implement. In many cases, the difference was not only in the JavaScript engine, but in other functions of the browsers, like how these displayed content on the page, how was the styling applied, and so on. Because of these differences, | ||
| - | The segregation of JavaScript implementations did not help the language to get embraced by the community and web developers. This was the situation until 2006, when the first stable version of the jQuery (http:// | + | The segregation of JavaScript implementations did not help the language to get embraced by the community and web developers. This was the situation until 2006, when the first stable version of the jQuery (http:// | 
| + | |||
| + | Vous pourriez vous demander pourquoi j'ai choisi de présenter JavaScript dans cette série d' | ||
| + | |||
| + | C'est bien connu que (habituellement) JavaScript s' | ||
| + | |||
| + | La ségrégation des implémentations de Javascript n'a pas vraiment incité la communauté et les développeurs Web à l' | ||
| + | |||
| + | ===== 2 ===== | ||
| - | Nowadays, the three most widely used browsers (Google Chrome, Firefox and Internet Explorer) got to a point when these can support the standard of the language, so developers and users have a more unified programming and running environment. | + | **Nowadays, the three most widely used browsers (Google Chrome, Firefox and Internet Explorer) got to a point when these can support the standard of the language, so developers and users have a more unified programming and running environment. | 
| The first version of JavaScript was developed by Brendan Eich (http:// | The first version of JavaScript was developed by Brendan Eich (http:// | ||
| - | In the past twenty years, there were different versions of the language and there was a need to define a standard. The standardization was done by ECMA International and the standard for the language is called ECMAScript (http:// | + | In the past twenty years, there were different versions of the language and there was a need to define a standard. The standardization was done by ECMA International and the standard for the language is called ECMAScript (http:// | 
| - | As the language’s name suggests, this is a script language; it needs a runtime (engine) to be executed. We call this the JavaScript engine, and these runtime environments (try to) implement the ECMA standard. The most widely known and used JavaScript engine is V8 (https:// | + | Aujourd' | 
| + | |||
| + | La première version de JavaScript fut développée par Brendan Eich (http:// | ||
| + | |||
| + | Au cours des dernières vingt années, il y a eu diverses versions du langage et le besoin de définir un standard s'est fait sentir. La standardisation fut faite par ECMA International et le standard pour le langage s' | ||
| + | |||
| + | ===== 3 ===== | ||
| + | |||
| + | **As the language’s name suggests, this is a script language; it needs a runtime (engine) to be executed. We call this the JavaScript engine, and these runtime environments (try to) implement the ECMA standard. The most widely known and used JavaScript engine is V8 (https:// | ||
| Nowadays, there is no webpage which would not use some kind of JavaScript for displaying content, modifying the layout, loading data, displaying charts, generating PDF files or even editing images. So, in case you want to build web pages or build your own web site, learning a little bit of JavaScript (JS) will help to do the job. | Nowadays, there is no webpage which would not use some kind of JavaScript for displaying content, modifying the layout, loading data, displaying charts, generating PDF files or even editing images. So, in case you want to build web pages or build your own web site, learning a little bit of JavaScript (JS) will help to do the job. | ||
| - | The purpose of this series is to present the JavaScript language using simple examples. In the beginning we will need only a text editor, it’s good if it has syntax highlighting. It can be Notepad++, Gedit, Vim, Emacs, but you may use anything you like. Syntax highlighting helps to visually separate different parts of the code (keywords, values, comments, types) and spot coding errors quickly. We will need a browser too. I prefer Google Chrome, but you are free to use any browser; the examples in the beginning will run in the same way in every browser. The JS’s syntax is C-based, and it supports object oriented (http:// | + | The purpose of this series is to present the JavaScript language using simple examples. In the beginning we will need only a text editor, it’s good if it has syntax highlighting. It can be Notepad++, Gedit, Vim, Emacs, but you may use anything you like. Syntax highlighting helps to visually separate different parts of the code (keywords, values, comments, types) and spot coding errors quickly. We will need a browser too. I prefer Google Chrome, but you are free to use any browser; the examples in the beginning will run in the same way in every browser. The JS’s syntax is C-based, and it supports object oriented (http:// | 
| - | In the beginning, we will focus only on client side JS, so we will need a minimalistic web page to run our JavaScript. On the client side, besides JavaScript, other technologies, | + | Comme le nom du langage laisse supposer, c'est un langage de script ; il a besoin d'un runtime (moteur) pour s' | 
| + | |||
| + | De nos jours, aucune page Web n' | ||
| + | |||
| + | L' | ||
| + | |||
| + | ===== 4 ===== | ||
| + | |||
| + | **In the beginning, we will focus only on client side JS, so we will need a minimalistic web page to run our JavaScript. On the client side, besides JavaScript, other technologies, | ||
| Let’s start the series with the traditional hello world program. First we create a new JavaScript file, let’s name it hello_world.js. The extension of JavaScript files is .js. Content: | Let’s start the series with the traditional hello world program. First we create a new JavaScript file, let’s name it hello_world.js. The extension of JavaScript files is .js. Content: | ||
| Ligne 29: | Ligne 55: | ||
| Now (below) we need to create the html webpage, let’s name the file hello.html. | Now (below) we need to create the html webpage, let’s name the file hello.html. | ||
| - | HTML is a markup language which is used in web development. As we advance with the series, I will present more and more HTML elements besides JavaScript programming. | + | HTML is a markup language which is used in web development. As we advance with the series, I will present more and more HTML elements besides JavaScript programming.** | 
| - | The HTML files contain tags (also called HTML elements), which are present in the form of: | + | Au départ, nous nous concentrerons seulement sur le JS côté client ; nous aurons donc besoin d'une page Web minimaliste pour exécuter le JavaScript. Côté client, outre JavaScript, d' | 
| + | |||
| + | Commençons la série avec le programme traditionnel Hello World. D' | ||
| + | |||
| + | < | ||
| + | |||
| + | //</ | ||
| + | |||
| + | alert(“Hello JavaScript World!”); | ||
| + | |||
| + | Maintenant (ci-dessous), | ||
| + | |||
| + | HTML est un langage structuré qui est utilisé pour le développememt Web. En avançant dans la série, je vous présenterai de plus en plus d' | ||
| + | |||
| + | ===== 5 ===== | ||
| + | |||
| + | **The HTML files contain tags (also called HTML elements), which are present in the form of: | ||
|  < |  < | ||
| Ligne 39: | Ligne 81: | ||
| •  HTML File version – this is the first line in the HTML web page, usually the version is between < | •  HTML File version – this is the first line in the HTML web page, usually the version is between < | ||
| •  HTML head element (< | •  HTML head element (< | ||
| - | •  HTML body (< | + | •  HTML body (< | 
| - | We can run our Hello World application by opening the hello.html file in a browser and we should see something like this: | + | Les fichiers HTML contiennent des balises (appelées également des éléments HTML), qui s' | 
| + | < | ||
| + | |||
| + | Ces balises sont interprétées et rendues par le navigateur pour afficher le contenu de nos pages Web. | ||
| + | |||
| + | Les fichiers HTML sont composés de trois parties principales : | ||
| + | •  Version du fichier HTML : il s'agit de la première ligne de la page Web HTML et, d' | ||
| + | •  L' | ||
| + | •  Le corps HTML (< | ||
| + | |||
| + | ===== 6 ===== | ||
| + | |||
| + | **We can run our Hello World application by opening the hello.html file in a browser and we should see something like this: | ||
| The execution flow in the browser is the following: when the browser loads the hello.html file, in the first line it can see that this is an HTML5 file, it reads the head element and, as specified in the meta tag, it loads an UTF-8 charset. The next line is the script tag: <script src=" | The execution flow in the browser is the following: when the browser loads the hello.html file, in the first line it can see that this is an HTML5 file, it reads the head element and, as specified in the meta tag, it loads an UTF-8 charset. The next line is the script tag: <script src=" | ||
| Ligne 48: | Ligne 102: | ||
| We have two other options to log or show messages to the user. One of the options is the console object; this prints values to the Console output of the Developer Tools within the browser. In that case the JavaScript code would be: | We have two other options to log or show messages to the user. One of the options is the console object; this prints values to the Console output of the Developer Tools within the browser. In that case the JavaScript code would be: | ||
| + | |||
| + | console.log(“Hello JavaScript World!”); | ||
| + | |||
| + | Nous pouvons lancer notre application Hello World en ouvrant le fichier hello.html dans un navigateur ; nous devrions voir quelque chose comme ceci : | ||
| + | |||
| + | Le flux d' | ||
| + | alert(“Hello JavaScript World!”); | ||
| + | |||
| + | La fonction alert() est disponible dans tous les navigateurs ; elle affiche une fenêtre dont le paramètre est le message. | ||
| + | |||
| + | Il existe deux autres options pour générer ou afficher des messages. L'une de ces options est l' | ||
| console.log(“Hello JavaScript World!”); | console.log(“Hello JavaScript World!”); | ||
| - | In Chrome, you can fire up the developer tools by pressing the F12 key. | + | ===== 7 ===== | 
| + | |||
| + | **In Chrome, you can fire up the developer tools by pressing the F12 key. | ||
| In case you are using Firefox, you can install an add-on, called FireBug (https:// | In case you are using Firefox, you can install an add-on, called FireBug (https:// | ||
| Ligne 59: | Ligne 126: | ||
| In the next part, we will look at JavaScript objects and functions; how can these be created, what are they, and why are they good to use. In case you would like to read about a particular topic, please email me at: greg@grelution.com. | In the next part, we will look at JavaScript objects and functions; how can these be created, what are they, and why are they good to use. In case you would like to read about a particular topic, please email me at: greg@grelution.com. | ||
| - | BIO : Gergo Bogdan is a software engineer, blogger, tech enthusiast from Budapest who is riding the waves of the constantly changing IT ocean. You can check his website at: http:// | + | BIO : Gergo Bogdan is a software engineer, blogger, tech enthusiast from Budapest who is riding the waves of the constantly changing IT ocean. You can check his website at: http:// | 
| + | |||
| + | Dans Chrome, vous lancez les outils du développeur en appuyant sur la touche F12. | ||
| + | |||
| + | Dans le cas où vous utilisez Firefox, vous pouvez installer une extension appelée FireBug (https:// | ||
| + | |||
| + | La deuxième option pour afficher des messages à l' | ||
| + | |||
| + | Dans la prochaine partie, nous allons examiner les objets et les fonctions JavaScript ; comment les créer, ce qu'ils sont et pourquoi c'est bien de les utiliser. S'il y a un sujet particulier sur lequel vous aimeriez avoir des renseignements, | ||
| + | |||
| + | BIO : De Budapest, Gergo Bogdan est un ingénieur logiciel, un blogueur et un passionné de technologie, | ||
| + | |||
issue96/programmation_javascript.1430990779.txt.gz · Dernière modification : 2015/05/07 11:26 de auntiee
                
                