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..e6dfc50dc 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..e6dfc50dc 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,9 +4,9 @@ - \ No newline at end of file + 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..509631e97 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 +# Vis en advarsel -Create a page that shows a message "I'm JavaScript!". +Opret en side der viser beskeden "Jeg er JavaScript!". -Do it in a sandbox, or on your hard drive, doesn't matter, just ensure that it works. +Gør det i en sandkasse, eller på din egen harddisk. Det er ligemeget hvor - bare det virker. :) [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..0ad046f40 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("Jeg er JavaScript!"); 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..51b2be6ef 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-koden: [html src="index.html"] -For the file `alert.js` in the same folder: +og her er JavaScript koden `alert.js` som skal ligge i samme folder: [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..5825354e1 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 +# Vis en advarsel med gennem et eksternt script -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. +Tag din løsning fra før . Tilret det, så du trækker JavaScript koden ud til en ekstern fil kaldet `alert.js` og som er placeret i samme folder som html-dokumentet. -Open the page, ensure that the alert works. +Åbn side for at sikre dig, at dialogboksen stadig vises. 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 b3149f112..b5af9daa0 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! -This part of the tutorial is about core JavaScript, the language itself. +Denne del af tutorialen er om ren JavaScript, selve komponenterne i sproget. -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. +Men, du behøver et miljø til at afvikle dine scripts og siden denne bog er en online bog, så er browseren et godt bud. Jeg vil holde browser-specifikke kommandoer (som `alert`) til et minimum. Det gør jeg, hvis du f.eks. læser dette for at arbejde i andre miljøer (som f.eks. Node.js). Jeg vil fokusere på JavaScript i browseren i den [næste del](/ui) af tutorialen. -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"`. +Først, lad os se, hvordan du kobler et script til en webside. For server-side miljøer som Node.js, kan du afvikle scripts med kommandoen`"node my.js"`. -## The "script" tag +## "script" tagget -JavaScript programs can be inserted into any part of an HTML document with the help of 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. +Her er `/path/to/script.js` en absolut sti til scriptet fra sitets rod. Du kan også give en relativ sti fra det aktuelle HTML-dokument. F.eks. betyder `src="script.js"` at filen `"script.js"` findes i samme folder som HTML-dokumetet. -We can give a full URL as well. For instance: +Endelig, kan du give en fuld URL som f.eks: ```html ``` -To attach several scripts, use multiple tags: +Hvis du vil koble flere eksterne scripts til dokumentet skal du bruge flere tags: ```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. +Som regel er det kun meget simple scripts der skrives direkte i HTML. Mere komplekse scripts placeres i eksterne filer. -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). +En fordel ved eksterne filer er, at browseren vil downloade dem og gemme dem i sin [cache](https://en.wikipedia.org/wiki/Web_cache). -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. +Andre dokumenter der referer til den samme fil vil så læse den fra chachen i stedet for at downloade det igen. -That reduces traffic and makes pages faster. +Det sparer trafik og gør siden hurtigere. ``` -````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 +## Opsummering -- We can use a ``. +- Du bruger et ``. -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. +Der er meget mere at lære om browser scripts og deres interaktion med selve websiden. Men husk, at denne del af tutorialen har fokus på JavaScript sproget, så jeg vil ikke forvirre med for mange browser-specifikke emner. Du vil bruge en browser som en måde at afvikle JavaScript, som passer godt med denne online bog. Men, det er kun en af mange måder JavaScript kan afvikles. diff --git a/1-js/02-first-steps/index.md b/1-js/02-first-steps/index.md index 31281656f..50b82ef59 100644 --- a/1-js/02-first-steps/index.md +++ b/1-js/02-first-steps/index.md @@ -1,3 +1,3 @@ -# JavaScript Fundamentals +# Grundlæggende JavaScript -Let's learn the fundamentals of script building. \ No newline at end of file +Lær alle grundstenene i programmering med JavaScript.