From f56005fbf4b5fce0199711c2eed21978996f869f Mon Sep 17 00:00:00 2001 From: "shigeru.nakajima" Date: Mon, 30 Nov 2026 20:07:30 +0900 Subject: [PATCH] Complete the nb-no translation of the Object Keys exercise --- i18n/nb-no.json | 1 + problems/object-keys/problem_nb-no.md | 20 +++++++++----------- problems/object-keys/solution_nb-no.md | 8 ++++---- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/i18n/nb-no.json b/i18n/nb-no.json index 728274ac..a2324b47 100644 --- a/i18n/nb-no.json +++ b/i18n/nb-no.json @@ -16,6 +16,7 @@ , "LOOPING THROUGH ARRAYS": "ITERERE GJENNOM ARRAYER" , "OBJECTS": "OBJEKTER" , "OBJECT PROPERTIES": "OBJEKTEGENSKAPER" + , "OBJECT KEYS": "OBJEKTNØKLER" , "FUNCTIONS": "FUNKSJONER" , "FUNCTION ARGUMENTS": "FUNKSJONSARGUMENTER" , "SCOPE": "KONTEKST" diff --git a/problems/object-keys/problem_nb-no.md b/problems/object-keys/problem_nb-no.md index 1b07c63f..86bc0aa7 100644 --- a/problems/object-keys/problem_nb-no.md +++ b/problems/object-keys/problem_nb-no.md @@ -1,7 +1,6 @@ -JavaScript provides a native way of listing all the available keys of an object. This can be helpful for looping through all the properties of an object and manipulating their values accordingly. +I JavaScript kan du bruke `Object.keys()` for å hente nøklene til et objekt. Du kan gå gjennom nøklene i en løkke og bruke hver nøkkel til å lese eller endre verdien til den tilhørende egenskapen. -Here's an example of listing all object keys using the **Object.keys()** -prototype method. +Her henter vi nøklene fra et objekt som beskriver en bil. ```js const car = { @@ -14,13 +13,11 @@ const keys = Object.keys(car) console.log(keys) ``` -The above code will print an array of strings, where each string is a key in the car object. `['make', 'model', 'year']` +Koden skriver ut `['make', 'model', 'year']`. Hver streng i denne lista er en nøkkel i objektet `car`. -## The challenge: +## Oppgaven -Create a file named `object-keys.js`. - -In that file, define a variable named `car` like this: +Lag en fil som heter `object-keys.js`. Definer variabelen `car` slik i fila: ```js const car = { @@ -30,14 +27,15 @@ const car = { } ``` -Then define another variable named `keys` like this: +Definer deretter variabelen `keys` og la den inneholde nøklene til `car`: + ```js const keys = Object.keys(car) ``` -Use `console.log()` to print the `keys` variable to the terminal. +Bruk `console.log()` til å skrive ut `keys` i terminalen. -Check to see if your program is correct by running this command: +Kjør denne kommandoen for å sjekke at programmet ditt fungerer: ```bash javascripting verify object-keys.js diff --git a/problems/object-keys/solution_nb-no.md b/problems/object-keys/solution_nb-no.md index 0f3540ea..07d4709d 100644 --- a/problems/object-keys/solution_nb-no.md +++ b/problems/object-keys/solution_nb-no.md @@ -1,11 +1,11 @@ --- -# CORRECT. +# RIKTIG! -Good job using the Object.keys() prototype method. Remember to use it when you need to list the keys of an object. +Du har brukt `Object.keys(car)` til å hente nøklene til bilobjektet. Bruk denne metoden når du trenger en liste over nøklene til et objekt. -The next challenge is all about **functions**. +Den neste oppgaven handler om **funksjoner**. -Run `javascripting` in the console to choose the next challenge. +Kjør `javascripting` i terminalen for å velge neste oppgave. ---