Notes JavaScript Flashcards

1
Q

What must all methods have?

A

a period
method name
parentheses

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

Define methods

A

They return information about an object and are called by appending an instance.

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

Define Built in objects

A

Contain methods that can be called by appending the object name with a period, method name and parentheses.

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

Define Template Literals

A

They are strings that allow embedded expressions ${expression}
They use back ticks instead of quotation marks. key below esc button

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

What does an iteration statement do?

A

Updates the iterator each time the loop is created

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

What does a stopping condition do?

A

Determines when to stop looping. It will run until the expression evaluates to false.

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

What does initialization do?

A

Defines where to begin the loop by declaring (or referencing) the iterator variable.

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

Define how objects execute “when passed as arguments”.

A

They are passed by reference and are therefore mutable.
The object itself is not a copy
The object is accessible and mutable inside the function.

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

Define Javascript object literal value key pairs.

A

*Key-value pairs of an object can be referred to as properties.
*They are enclosed in curly brackets {}
*Values are mapped to keys in the object with a colon symbol :
*Key value pairs are separated by commas ,
*All keys are unique, VALUES are not.

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

What does method Math.floor (); do?

A

Returns the largest number integer less than or equal to the given number.

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

What does Math.random (); do?

A

Returns a number between 0 and 1

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

Define numbers.

A

Primitive data type
include the set of all integers and floating point numbers.

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

Define block scope variables.

A

The variables ‘const’ and ‘let’ are only accessible in their block or nested block.

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

Define code block scope.

A

Only visible within a code block – in-between curly brackets.
{…}

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

Define function scope.

A

Only visible within the function

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

Define file or module scope.

A

The value/function can only be accessed from within the file.

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

Define Global scope.

A

A value/function in global scope can be used anywhere in the entire program.

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

Define scope.

A

Scope is a concept that refers to where values and functions can be accessed.

19
Q

Define strings.

A

They are a primitive data type
They are any grouping of characters (letters, spaces, number or symbols) surrounded by single or double quotes.

20
Q

Define console.log

A

A method that is used to log or print messages to the console.

21
Q

Define .length

A

.length is a property of the string
Returns the number of characters that make up the string
indicates the number of elements an array contains.

22
Q

Define “else block”.

A

Else block is added to a an “if” block or series of “else if” code blocks.
The “else” block will be executed only if the “if” condition fails.

23
Q

Explain what methods do.

A

Methods return information about an object.
Are called by an instance with a period.
.”the method”, name and parentheses
example: console.log ()

24
Q

Explain “undefined”.

A

Undefined is a primitive Javascript value.
It represents lack of defined value
Variables declared but not initialized will have a value undefined.

25
Q

Define “let”.

A

Creates a local variable in Javascript.
It can be re-assigned.

26
Q

What happens if you use a function with parentheses

A

The function is being called right then and there.

27
Q

What happens when you use a function without parentheses

A

The function is being assigned to the event handler, to be run later when that event happens.

28
Q

Define .map()

A

.map () executes a callback function on each element of an array.
The original array does not get altered, and the returned array may contain different elements than the original array.

29
Q

Define anonymous functions

A

Anonymous functions in Javascript do not have a name property.
They can be defined using the function keyword or as an arrow function.

30
Q

What is a “function declaration”?

A

A function body enclosed in a set of curly brackets {}.

31
Q

How are “function declarations” used?

A

Function declarations are used to create named functions.
These functions can be called using their declared name.

32
Q

What do the “function declarations” include?

A

The function keyword
The function name
Parentheses

**An optional list of parameters are separated by commas and enclosed in parentheses.

33
Q

Define function expression

A

Function expressions create functions inside an expression instead of as a function declaration.
They can be anonymous and/or assigned a variable.

34
Q

Define arguments

A

Values passed into a function when it is called.

35
Q

Define calling functions

A

Functions can be called or executed elsewhere in the code using parentheses following the function name.
When called the code inside its function body will run.

36
Q

Define “arrow function” properties.

A

Arrow function expression does not require the function keyword
=> separates the parameter from the body
Arrow functions with a single parameter
do not need parentheses around the parameter list.
Arrow functions with a single expression can use the concise function body which returns the result of the expression without sing the return keyword.

37
Q

Define Logical “NOT !” operator.

A

! will invert a boolean value
! will invert the truthiness of Non-boolean values.

38
Q

Define “break”.

A

Break is used with “switch”
If “break” is omitted from the block of a case the switch statement will continue
to check against case values until a break is encountered or the flow is broken.

39
Q

Define “case” clause.

A

Case clause is used with “switch”
If there are no matches but a default “clause” is included in the code inside then “default” will be executed.

40
Q

Define “switch statements”.

A

Provides a means of checking an expression against multiple case clauses
Case clauses should finish with a “break”.

41
Q

List the “Falsy” Values

A

False
0
empty strings
NULL
UNDEFINED
NAN

42
Q

Define logical OR || operator.

A

The || operator checks to values an returns a boolean.
If one or both values are truth, it will return TRUE.
If both are false it will return FALSE.
The button on the keyboard is above the return button used with shift key.

43
Q

Define String Interpolation.

A

String interpolation is the process of evaluating string literals containing one ore more place holders
(Expressions, variables, etc)
${…}
It can be performed using template literals
TEXT${expression}TEXT

44
Q

Define variables.

A

A variable is a container for data that can be used in the program elsewhere.
To declare a variable use these keywords with a variable name.
VAR
LET – preferred way to declare when it can be reassigned
CONST– variable with a constant value.