JavaScript Flashcards

1
Q

What is a variable?

A

container to store data

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

What is a string?

A

characters

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

What is the difference when it comes to using single quotes or double quotes ( ‘ ‘ or “ “ )?

A

nothing

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

How do you escape quotation characters?

A

\

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

What is type coercion?

A

converting type

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

What is a number in JavaScript?

A

a data type

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

What is an arithmetic operator?

A

mathematical function

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

Name four of the arithmetic operators?

A

+ - * / %

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

Why is the typeof an object null?

A

object

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

What is the difference between null and undefined?

A

null is assigned null

undderfined is no assigned value

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

Why do you always use === for comparisons?

A

to make sure data type are same

eg 0 is a falsy value but ‘0’is truthy

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

What is the difference between undefined and null?

A

undefined is never assigned value;

null use to assign variable is needed to represent no value

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

What is a function?

A

a group of statement to do some special task.

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

Why are functions useful?

A

templating reusable

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

How do you call a function?

A

Function name with parentheses and argument

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

What are the parts of a function definition?

A
Function Keyword
Function Name 
Parameter
Code Block
Return inside Code Block
17
Q

What is the difference between a parameter and an argument?

A

parameter is part of function definition

argument is the value to pass in when call the function

18
Q

Why are variables useful?

A

remember value, store data

19
Q

What two special characters can a variable begin with?

A

$ _

20
Q

How do you declare a variable?

A

using variable keywords

var const let

21
Q

How do you assign a value to a variable?

A

assignment operator =

22
Q

Are variables case sensitive?

A

yes

23
Q

Which words cannot be used as variable names?

A

Reserved word

eg if function var while …

24
Q

Do all if statements require an else statement?

A

no

25
Q

What is an array in JavaScript?

A

An array is a special variable, which can hold more than one value at a time.

26
Q

How do you create an array literal?

A

var array = [ 1,2,3,4,5];

27
Q

What are the keys for the values inside an array?

A

numeric number from 0

28
Q

Arrays have a property named length. Because arrays have a properties, what other data structure are they similar to?

A

object;