Chapter 2 - Data And Decisions Flashcards

0
Q

What is a number?

A

A number, including floating points number

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

What is a string?

A

A series of characters

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

What is a boolean data?

A

True or false

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

What are the 3 primitives data types?

A

String
Number
Boolean

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

What is Null?

A

Even though a variable had been created, its current value is Null or nothing

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

What is Undefined?

A

Indicates that something has not been defined and given a value

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

How does string data must be encloses?

A

Between ‘ ‘ or “ “

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

How to write a string like Paul’s character?

A

Document.write(“Paul’s character”)

Use the “ because there is a ‘ in the string

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

What are escape séquences?

A

To use character that can’t be typed using a keyboard

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

\b

A

Backspace

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

\f

A

Form Feed

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

\n

A

Newline

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

\r

A

Carriage return

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

\t

A

Tab

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

'

A

Single quote

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

"

A

Double quote

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

\

A

Backslash

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

\xNN

A

nN is a number from hexadecimal

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

\uDDDD

A

DDDD is hexadecimal from Unicode

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

+

A

Adds

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

-

A

Substracts

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

*

A

Multiply

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

/

A

Divides

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

%

A

Modulus

24
Q

A

Decrease By 1

25
Q

++

A

Increase By 1

26
Q

+ with non number

A

Concatenate

27
Q

How to name variable?

A

Camel notation anusToMouth

28
Q

Prompt()

A

Ask the user a value and returns it to the code

Var eurosToConvert = prompt(“How many…”, “”);

29
Q

Typeof()

A

Know the type of data

30
Q

Number()

A

Tries to convert to number

31
Q

Parsefloat()

A

Tries to convert to a floating number. Or NaN

32
Q

ParseInt()

A

To an integer

33
Q

3 objects from javascript

A

String
Date
Math

34
Q

How to create a string object?

A

Implicit and explicit

35
Q

Object.length

A

Give the length of a string object

36
Q

Explicit string?

A

Var MyStringObject = new String( “abc” );

37
Q

UserEmail.indexOf( “@” ); ?

A

Return -1 if No @ found

38
Q

myOldString.substring( 2, 5);

A

Return character 3 to 5 because it starts at 0 and doesn’t include the last one (5)

39
Q

How can I create Date objects?

A
Only explicitely
Var todaysdate = new Date();
40
Q

How to specify the month of a date?

A

3 First letter

41
Q

Date object parameter

A

Var someDate = new Date( aYear, aMonth, aDate, anHour, aMinute, aSecond, aMillisecond)

42
Q

Where does date month start count ing?

A

0

43
Q

Date objects method?

A

getXXXX and setXXXX

44
Q

What does setDate(32); so?

A

Go to the next month (useful to add days)

45
Q

How to create a math object?

A

Only implicitely

46
Q

Does the math object store data?

A

No

47
Q

How to call a math object method?

A

Math.methodOfMathObject( aNumber )

48
Q

Math.parseInt()

A

Remove the decimals

49
Q

Math.round()

A

Round as usual

50
Q

Math.ceil()

A

Always round up

51
Q

Math.floor()

A

Rounds down

52
Q

Math.random()

A

Random between 0 and 1

53
Q

Use of an Array?

A

Store data

54
Q

How to initialize an Array?

A

Var preInitArray = new Array(“First Item”, “Second Item”, “Third Item”);

55
Q

How to Set an Array to hold 3 items?

A

Var PreDeterminedSizeArray = new Array( 3 );

56
Q

How to create an Empty Array?

A

Var anArray = new Array();

57
Q

How to add new items to an Array?

A
anArray[0] = "anItem";
anArray[1] = "anotherItem";
58
Q

Shortcut notation to add to an Array?

A

Var myArray = [ 1, 2, 3];