JavaScript - Basics Flashcards

1
Q

ECMA Script is

A

The standard for javascript

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

A variable is not a value, but …

A

it points to a value

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

When naming a variable, it must start with…

A

a letter

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

When creating a variable we use the case convention called

A

camelCase

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

The difference between let and const is…

A

let creates variables that can have the value reassigned, const for the variables that shouldn’t be reassigned

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

The two categories of data types are

A

Primitives (immutable) and non-primitives (mutable)

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

The 7 primitive data types are:

A

string, number, bigint, boolean, undefined, null and symbol

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

The non-primitive data type is:

A

objects

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

If… else and switch statements are:

A

conditional statements

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

&& means

A

and

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

|| means

A

or

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

What is the syntax of a ternary operator?

A

condition ? return if condition is true : return if condition is false

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

A function is

A

a block of code that can be reused

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

What’s the difference between parameters and arguments?

A

parameters are defined when we create the function, arguments is the value we pass when calling the function

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

The return statement will

A

stop the execution of the function and give a value in return

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

How do I access the first element of const myArr = [“Ana”, 32, true]

A

myArr[0]

17
Q

How do I check the length of the array const myArr = [“Ana”, 32, true]

A

myArr.length

18
Q

What is a higher order function?

A

a function that accepts another function as the argument

19
Q

What is a callback function?

A

a function that is passed as the argument to another function (a higher order function)

20
Q

Are arrays a data structure?

A

Yes

21
Q

When creating a for loop, what are the 3 statements necessary?

A

initial value, condition to meet, what to do after each loop

22
Q

What’s the difference between a while loop and a do while loop?

A

the while loop will always check the condition first and only run if condition is met, the do while loop will run the code once, then check the condition on the following loop

23
Q

If a condition of a loop is never met, what happens?

A

We create an infinite loop

24
Q

What does DOM stands for

A

Document Object Model

25
Q

If I want to target something by its ID, which method do we use?

A

document.getElementById(“idToTarget”)

26
Q

What happens when we use the innerHTML property?

A

we have access the content of a node element

27
Q

How can we create new HTML elements?

A

document.createElement(‘elementTag’)

28
Q
What is the spead operator used for?
const numbersArray = [1, 2, 3]
A

spread out elements of an iterable object

console.log(…numbersArray) //1 2 3

29
Q
What is the value of rest?
const numbers = [13, 23, 43, 54, 15]
const [a, b, ...rest] = numbers
A

[43, 54, 15]