-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
49 lines (42 loc) · 2.01 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Oppgave 1
// Å deklarere en variabel betyr at man lager en variabel, det blir ikke gitt noen verdi
let variabel;
// Nå er variabelen deklarert og har ikke en verdi.
// Oppgave 2
// Å initialisere en variabel betyr at man lager plass for den i minnet slik at den kan bli brukt.
variabel = "Bawls";
// Oppgave 3
let exempelVariabel = "eksempel";
// Oppgave 4
// let og var er to forskjellige måter man kan definere en variabel. Var er egentlig deprecated og skal ikke brukes lenger.
// Var blir "hoistet" opp i koden, det betyr at den blir dratt til toppen og leses før andre elementer, på denne måten kan du
// initialisere en variabel
varIable = "rocky";
// Før du deklarer den
var varIable;
// I moderne javascript så skal du unngå å bruke var, det eneste man skal deklarere en variabel med er "let" og "const".
// Oppgave 5
// Hvis du deklarer en variabel med const så er det ikke mulig å bytte verdien etter den originale verdien blir gitt.
const konstant = "Kan ikke endres";
// Med let så kan du endre verdien når som helst i scopet som variabelen existerer i.
let kanEndres = "Kan endres";
kanEndres = "Ble endret";
//Jeg kan endre verdien når let er brukt, men hvis jeg hadde prøvd det samme med en const så ville koden krasjet.
// Oppgave 6
// Noen datatyper er for eksempel "string", "number", "object" og "boolean". String er tekst, number er tall, object er en samling av
// properties og boolean er om noe er sant eller usant, altså har verdien "true" eller "false".
// Retteskjema
// Oppgaven viser tydelig forståelse av forskjellen på intitialisere og deklarere 2/2
// Oppgave 1, 2 og 3 har korrekt utførte eksempler 3/3
// Oppgave4
// -kan redegjøre for og begrunne hvilken variabeltype som er moderne 2/2
// -kan bruke scope og funksjonsbase i begrunnelsen 3/4
// Oppgave5
// 2/2
// Oppgave6
// De tre “grunnleggende” datatypene blir navngitt.Bonuspoeng for andre 4/3
// Oppgave7
// Oppgaven er levert med utfylt retteskjema 4/4
// Oppgave8
// Oppgaven er levert med Korrekt filnavn 2/2
// Total sum: 22/22