JS Flashcards

1
Q

what are the two steps for creating a variable?

A

variable declaration and variable assignement

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

how do you turn a string to a number?

A

use the Number method Number()

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

how do you turn a number to a string?

A

use the string method String()

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

what data type does the prompt command return?

A

the prompt() command always returns a string value

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

what is the DOM?

A

The DOM stands for “Document Object Model” and is a tree-like structure that is a representation of the HTML document, the relationship between elements, and contains the content and properties of the elements.

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

what is a program?

A

a list of commands telling a computer what to do. These orders are written as text files and make up what’s called the “source code” of the program. The lines of text in a source code file are called lines of code.

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

what is a variable?

A

it is an information storage area

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

how do you iterate over an array

A

usign a for loop , a foreach or a for-of

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

how do you obtain an arrays size

A

using the .length method

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

how do i add an element to the end of an array?

A

array.push(element)

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

how do i add an element to the beginning of an array?

A

array.unshift(element)

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

how do you remove an element from the end of an array?

A

array.pop()

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

how to concatenate array elements into a string?

A

use array.join(“”) method the symbol used in the parameter surrounds the string, if any space is added in the middle itll separate the elements with said space

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