Programmering Flashcards

1
Q

.push()

A

Tilføj et element til sidst i et array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

.pop()

A

Fjern sidste element i et array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

.shift()

A

Fjern første element i et array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

.unshift()

A

Tilføj et element først i et array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Object literal

A
Den normale oprettelse af et objekt
let x = {property: key}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Array

A

let array = [];

En liste af ting man kan samle i én variabel.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

content

A

CSS: ID selector

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

.content

A

CSS: class selector

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

getElementById()

A

Tilgå et specifikt DOM‐element via dets id.
Returnerer et enkelt element eller null hvis elementet med det givne id ikke findes

let content = document.getElementById(‘content’);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

querySelector()

A

Brug css‐selektorer til at udvælge det DOM‐element der ønskes. Hvis flere returneres det først element.
Samme syntaks som css

let paragraph = document.querySelector(‘#article1 p’);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Logical operators

A

&& || ! ?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Ternary operator

A

?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Function expression

A

En funktion gemmes i en variabel ‐> function expression

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Function declaration

A

Oprettelse af funktion

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Arrow function

A

let multiply = (x,y) => x*y;

Implicit return

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Constructor function

A

Hvor object literal laver ét objekt, kan constructor lave flere objekter af samme type

17
Q

for-in løkke

A

kan bruges til at tælle properties i et objekt.

for(let property in properties) {
console.log(property);
}

18
Q

Map

A

A collection of keyed data items, just like anObject. Objects only support string keys - Maps support more or less any key type.

let word count = new Map();

19
Q

Set

A

ASetis a special type collection – “set of values” (without keys), where each value may occur only once.

20
Q

JSON

A

(JavaScript Object Notation) is a general format to represent values and objects.
Støtter objekter, arrays, primitives (strenge, num, bool).
Strings —> kun double quotes

21
Q

Callback funktion

A

Asynkron programmering. Funktionen bliver kaldt når data er klar (den bliver sat i kø og kaldt når det er dens tur) .

22
Q

Algoritme

A

En algoritme er en række formelle veldefinerede skrift som løser en specifik opgave

23
Q

Template literal

A

Backtick-quoted strings that can do more tricks than when using single or double quotes, such like embed more values + ability to span lines

24
Q

While løkke

A

Bruges når vi ikke ved hvor mange gange et loop skal gentages. En forløber for for-løkken. Bruges sjældent

25
Q

For løkke

A

Gentag et eller flere statements et bestemt antal gange.
Tre-delt statement:
1. Begynd. Sker én gang.
2. Betingelse. Løkken kører mens betingelsen er opfyldt.
3. Step. Gør dette hver gang et loop er kørt

26
Q

Primitive værdier

A

Strenge, tal, booleans

27
Q

this (objekt)

A

This bruges til at referere det objekt koden er inden for konteksten af.
Hvis vi vil benytte os af et objekts properties i en af objektets metoder, bliver vi nød til at bruge this for at tilgå den ønskede property. Uden brug af this vil javascript lede efter en lokal/global variabel

28
Q

Reg ex

A

En måde at udtrykke tekstmønstre i forbindelse m søgning i en tekst.

29
Q

Flags (regex)

A

6 flag:

  • i: case insensitive
  • g: global. alle matches
  • m: multiline
  • s: tillader ett punktum
30
Q

Karakterklasser (regex)

A
Acharacter classis a special notation that matches any symbol from a certain set.
3
- \d: any single digit
- \s: space, tab, newline
- \w: ord
31
Q

Inverse classes

A

For every character class there exists an “inverse class”, denoted with the same letter, but uppercased.

\D
\W
\S

32
Q

Quantifier (regex)

A

A number is a sequence of 1 or more digits\d. To mark how many we need, we can append aquantifier.