Basic 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

Why are variables useful?

A

as a reference, to go and get that data

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

What two special characters can a variable begin with?

A

$ dollar sign and _ underscore

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

How do you declare a variable?

A

the var keyword

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

How do you assign a value to a variable?

A

= known as the assignment operator or equal sign

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

Are variables case sensitive?

A

Yes

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

Which words cannot be used as variable names?

A

function, var, if, else, switch, no numbers at the beginning. Basically keywords

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

What is a string?

A

sub series of characters enclosed by quotes

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

What is the string concatenations operator?

A

the plus sign

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

What is the difference when it comes to using single quotes or double quotes?

A

nothing

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

How do you escape quotations characters?

A

\ backslash

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

What is type coercion?

A

converting value from one type to another

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
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
14
Q

What is an arithmetic operator

A

math function that takes two operands and performs a calculation on them

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

Name four of the arithmetic operators

A

+ - * /

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

What is the order of execution?

A

(PEMDAS) mult and div before add and sub

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

What is a boolean?

A

true or false data type

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

What is a comparison operator?

A

comparing values to each other and resolve to a boolean

19
Q

What is the difference between undefined and null?

A

humans assign null and undefined is accidental

20
Q

What is a function?

A

block of code designed to perform a particular task

21
Q

Why are functions useful?

A

to be more productive

22
Q

How do you call a function?

A

with a parenthesis

23
Q

What are the parts of a function definition?

A

function keyword, parameter list, code block, return

24
Q

What is the difference between a parameter and an argument?

A

parameter is a named variable passed into a function, argument are the actual values passed to the function

25
Q

Why is it important to understand truthy and falsy values?

A

to check conditionals

26
Q

Why is the typeof an object null?

A

its a bug

27
Q

What is the difference between null and undefined?

A

null is an assigned value and undefined means a variable has been declared but not defined yet

28
Q

Why do you always use === for comparisons?

A

to not allow multiple different types of values or to make it more strict

29
Q

Why do you want to avoid using == for comparison?

A

to not have variance in the code

30
Q

Do all if statements require an else statement/

A

NO

31
Q

What is the proper syntax for using the or operator?

A

|| dual pipes

32
Q

What is the primary use case for switches?

A

allows a variable to be tested for equality against a list of values

33
Q

Does the default case have to be a at the bottom of the switch statement?

A

it can be at any place within the switch

34
Q

What happens if there is no break statement between cases?

A

the program continues to the next labeled statement.

35
Q

What is an object in JS?

A

unordered collection of related data. a collection of properties and methods linked together

36
Q

How do you create an object literal?

A
var object ={ };
var object = new Object( );
 its the same thing
37
Q

What is a property in relation to JS objects?

A

A place in which we store data inside on an object.

38
Q

When should you use bracket notation over dot notation with objects?

A

bracket notations allows the use of characters that can’t be used with dot notation. Also when a property name is a variable

39
Q

How do you remove a property from an object?

A

the delete operator deletes both the value of the property and the property itself.

40
Q

What is an array?

A

used to store a collection of data

41
Q

How do you create an array literal?

A

by using an enclosed square bracket

42
Q

What are the keys for the values inside an array?

A

numbers counting up from zero

43
Q

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

A

objects

44
Q

What are some good use cases for using objects inside arrays?

A

to remember the order of a series of objects. anything that involves a list of complex data