diff --git a/1-js/01-getting-started/index.md b/1-js/01-getting-started/index.md index b327c7860..02aedeb3b 100644 --- a/1-js/01-getting-started/index.md +++ b/1-js/01-getting-started/index.md @@ -1,3 +1,3 @@ -# An introduction +# Johdanto -About the JavaScript language and the environment to develop with it. +Tietoa JavaScript -kielestä ja sen kehitysympäristöstä. diff --git a/1-js/02-first-steps/01-hello-world/1-hello-alert/index.html b/1-js/02-first-steps/01-hello-world/1-hello-alert/index.html index ff1d871b0..055d3475c 100644 --- a/1-js/02-first-steps/01-hello-world/1-hello-alert/index.html +++ b/1-js/02-first-steps/01-hello-world/1-hello-alert/index.html @@ -4,7 +4,7 @@ diff --git a/1-js/02-first-steps/01-hello-world/1-hello-alert/solution.view/index.html b/1-js/02-first-steps/01-hello-world/1-hello-alert/solution.view/index.html index 45e6744b3..6adbb51a1 100644 --- a/1-js/02-first-steps/01-hello-world/1-hello-alert/solution.view/index.html +++ b/1-js/02-first-steps/01-hello-world/1-hello-alert/solution.view/index.html @@ -4,7 +4,7 @@ diff --git a/1-js/02-first-steps/01-hello-world/1-hello-alert/task.md b/1-js/02-first-steps/01-hello-world/1-hello-alert/task.md index afed6a91d..1e524d7a1 100644 --- a/1-js/02-first-steps/01-hello-world/1-hello-alert/task.md +++ b/1-js/02-first-steps/01-hello-world/1-hello-alert/task.md @@ -2,11 +2,11 @@ importance: 5 --- -# Show an alert +# Näytä alert (ponnahdusikkuna) -Create a page that shows a message "I'm JavaScript!". +Luo sivu, joka näyttää viestin "Minä olen JavaScript!". -Do it in a sandbox, or on your hard drive, doesn't matter, just ensure that it works. +Ei ole väliä teetkö sen hiekkalaatikossa vai omalla kovalevylläsi. Varmista vain, että se toimii. [demo src="solution"] diff --git a/1-js/02-first-steps/01-hello-world/2-hello-alert-ext/alert.js b/1-js/02-first-steps/01-hello-world/2-hello-alert-ext/alert.js index 4de725971..92c1c5846 100644 --- a/1-js/02-first-steps/01-hello-world/2-hello-alert-ext/alert.js +++ b/1-js/02-first-steps/01-hello-world/2-hello-alert-ext/alert.js @@ -1 +1 @@ -alert("I'm JavaScript!"); \ No newline at end of file +alert("Minä olen JavaScript!"); \ No newline at end of file diff --git a/1-js/02-first-steps/01-hello-world/2-hello-alert-ext/solution.md b/1-js/02-first-steps/01-hello-world/2-hello-alert-ext/solution.md index f42c41e6d..3318afe75 100644 --- a/1-js/02-first-steps/01-hello-world/2-hello-alert-ext/solution.md +++ b/1-js/02-first-steps/01-hello-world/2-hello-alert-ext/solution.md @@ -1,8 +1,8 @@ -The HTML code: +HTML-koodi: [html src="index.html"] -For the file `alert.js` in the same folder: +Tiedostossa nimeltä `alert.js`, samassa kansiossa: [js src="alert.js"] diff --git a/1-js/02-first-steps/01-hello-world/2-hello-alert-ext/task.md b/1-js/02-first-steps/01-hello-world/2-hello-alert-ext/task.md index 26168d6a7..035363ed7 100644 --- a/1-js/02-first-steps/01-hello-world/2-hello-alert-ext/task.md +++ b/1-js/02-first-steps/01-hello-world/2-hello-alert-ext/task.md @@ -2,8 +2,8 @@ importance: 5 --- -# Show an alert with an external script +# Näytä ponnahdusikkuna (alert) erillisen skriptin avulla -Take the solution of the previous task . Modify it by extracting the script content into an external file `alert.js`, residing in the same folder. +Ota edellisen tehtävän ratkaisu ja siirrä skriptin sisältö erilliseen tiedostoon nimeltä `alert.js`, joka sijaitsee samassa kansiossa. -Open the page, ensure that the alert works. +Avaa sivu ja varmista, että ponnahdusikkuna toimii. diff --git a/1-js/02-first-steps/01-hello-world/article.md b/1-js/02-first-steps/01-hello-world/article.md index fa935f341..2ed610a7c 100644 --- a/1-js/02-first-steps/01-hello-world/article.md +++ b/1-js/02-first-steps/01-hello-world/article.md @@ -1,17 +1,17 @@ -# Hello, world! +# Hei maailma! Hello, world! -This part of the tutorial is about core JavaScript, the language itself. +Tämä osa tutoriaalista keskittyy JavaScriptin ytimeen eli kieleen itseensä. -But we need a working environment to run our scripts and, since this book is online, the browser is a good choice. We'll keep the amount of browser-specific commands (like `alert`) to a minimum so that you don't spend time on them if you plan to concentrate on another environment (like Node.js). We'll focus on JavaScript in the browser in the [next part](/ui) of the tutorial. +Tarvitsemme kuitenkin ympäristön, jossa voimme suorittaa skriptimme ja, koska tämä kirja on netissä, selain on hyvä valinta. Pidämme selainkohtaisten komentojen (kuten `alert`) määrän minimissä, jottei sinun tarvitse käyttää niiden oppimiseen aikaan, jos suunnittelet keskittyväsi johonkin muuhun ympäristöön (kuten Node.js) Keskitymme selaimen JavaScriptiin tämän tutoriaalin [seuraavassa osassa](/ui). -So first, let's see how we attach a script to a webpage. For server-side environments (like Node.js), you can execute the script with a command like `"node my.js"`. +Katsotaan ensin, miten saamme liitettyä skriptin nettisivuun. Palvelinpuolen ympäristöissä (kuten Node.js) voimme suorittaa skriptin esimerkiksi komennolla`"node my.js"`. -## The "script" tag +## "script" tunniste -JavaScript programs can be inserted almost anywhere into an HTML document using the ` */!* -

...After the script.

+

...Skriptin jälkeen.

@@ -35,24 +35,24 @@ For instance: ``` ```online -You can run the example by clicking the "Play" button in the right-top corner of the box above. +Voit suorittaa esimerkin skriptin painamalla "Play" painiketta yllä olevan laatikon oikeassa yläkulmassa. ``` -The ` ``` - This trick isn't used in modern JavaScript. These comments hide JavaScript code from old browsers that didn't know how to process the ` + ``` -Here, `/path/to/script.js` is an absolute path to the script from the site root. One can also provide a relative path from the current page. For instance, `src="script.js"` would mean a file `"script.js"` in the current folder. +Yllä, `/polku/tiedostoon/script.js` tarkoittaa absoluuttista tiedostopolkua skriptiin sivuston juuresta (root). Polun voi kirjoittaa myös nykyisen sivun suhteen. Esimerkiksi `src="script.js"` tarkoittaisi tiedostoa nimeltä `"script.js"` nykyisessä kansiossa. -We can give a full URL as well. For instance: +Voimme kirjoittaa myös koko URL-osoitteen. Esimerkiksi: ```html ``` -To attach several scripts, use multiple tags: +Voit käyttäää useampaa tunnistetta liittääksesi useamman skriptin: ```html @@ -90,29 +90,29 @@ To attach several scripts, use multiple tags: ``` ```smart -As a rule, only the simplest scripts are put into HTML. More complex ones reside in separate files. +Perussääntönä voidaan pitää, että vain erittäin yksinkertaisia skriptejä kirjoitetaan HTML:ään. Muut skriptit kirjoitetaan erillisiin tiedostoihin. -The benefit of a separate file is that the browser will download it and store it in its [cache](https://en.wikipedia.org/wiki/Web_cache). +Erillisen tiedoston hyötynä on, että selain lataa ja tallentaa sen [välimuistiin](https://fi.wikipedia.org/wiki/V%C3%A4limuisti). -Other pages that reference the same script will take it from the cache instead of downloading it, so the file is actually downloaded only once. +Jatkossa kaikki sivut, joihin on liitetty sama skripti, voivat lukea sen suoraan välimuistista lataamisen sijaan ja tiedosto itseasiassa ladataan vain kerran. -That reduces traffic and makes pages faster. +Tämä vähentää liikennettä ja tekee sivuista nopeampia. ``` -````warn header="If `src` is set, the script content is ignored." -A single ` ``` -We must choose either an external ` @@ -122,11 +122,11 @@ The example above can be split into two scripts to work: ``` ```` -## Summary +## Yhteenveto -- We can use a ``. +- Voimme käyttää ``. -There is much more to learn about browser scripts and their interaction with the webpage. But let's keep in mind that this part of the tutorial is devoted to the JavaScript language, so we shouldn't distract ourselves with browser-specific implementations of it. We'll be using the browser as a way to run JavaScript, which is very convenient for online reading, but only one of many. +Skripteissä ja niiden vuorovaikutuksessa nettisivun kanssa riittää opittavaa. Pidetään kuitenkin mielessä, että tämä osa tutoriaalista on omistettu JavaScript ohjelmointikielelle, joten meidän ei pidä keskittyä selainkohtaisiin asioihin. Käytämme kuitenkin selainta JavaScriptin suorittamiseen, mikä on erittäin kätevää tässä yhteydessä, mutta silti vain yksi mahdollisista tavoista.