Manipulating Data with Expressions Flashcards

(63 cards)

1
Q

What is an expression?

A

An expression is any code that resolves to a single value.

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

Is a string such as ‘hello’ or a number such as 10 considered an expression and why?

A

the string ‘hello’ and the number ‘10’ are both considered expressions because they are both a single value.

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

What is an easy way of remembering what an Expression?

A

“If it produces a value, it’s an expression.”

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

What do you use in order to perform mathematical calculations within a code?

A

To perform mathematical calculations within our code, we can use operators.

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

What is the symbol for the addition operator?

A

+

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

What is the symbol for the subtraction operator?

A

-

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

What is the symbol for the multiplication operator?

A

*

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

What is the symbol for the division operator?

A

/

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

What is using operators in order to calculate a result an example of?

A

Using operators in order to calculate a result is an example of Evaluation.

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

What is Evaluation?

A

Evaluation is the process of determining the value of an expression or statement in your code.

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

What is an Operand?

A

An Operand is a piece of data used by an Operator.

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

In the expression - 4 * 25, which are the first and second operands?

A

4 is the first operand and 25 is the second operand.

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

What is a Modulo Operator in JavaScript?

A

The Modulo Operator divides the first operand by the second operand and then evaluates it to a number showing the remainder.

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

What is the symbol for the Modulo Operator in JS?

A

The % symbol is used for the Modulo Operator in JS.

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

Which operator is great for finding out whether numbers are even or odd?

A

The Modulo Operator is a great operator to find out whether numbers are even or odd.

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

Using the Modulo Operator, how can you find out whether a number is even or odd?

A

Even numbers will produce a remainder of 0 when divided by 2 and Odd numbers will produce a remainder of 1 when divided by 2.

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

What is the symbol for Exponentiation?

A

The Exponentiation Symbol is **

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

What does The Exponentiation Operator do?

A

The Exponentiation Operator Multiplies the First Operand by itself a number of times equal to the Second Operand (the exponent)

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

What is the Exponent in an Exponentiation Operator?

A

An Exponent is the Second Operand

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

Write a code that contains the Exponentiation Operator.

A

const exponent = 10
const result = 7**exponent

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

What are ways to express the Exponentiation Operator in Human Language Form?

A

You can say “ten to the power of seven” or “ten to the seventh power” to express the Exponentiation Operator in Human Language Form.

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

Which symbol can be used to combine strings together?

A

The symbol + can be used to combine strings together.

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

What is a String?

A

A String is a sequence of characters, used typically to represent text.

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

What is ‘String Concatenation’?

A

String Concatenation is using the + operator to combine two Strings together.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What does String Concatenation allow you to do?
String Concatenation allows us to join Strings together to form a new String.
26
Where is the String Concatenation in - const greeting = 'hello' + 'world' - ?
'hello' + 'world'
27
Can you Concatenate Variables holding String Values?
Yes, you can concatenate variables holding string values.
28
How would you Concatenate - const area = 'North' & - const coolKids = 'coders' - ?
const coolestKidsOnThePlanet = area + coolKids // North Coders
29
What is Type Coercion in JavaScript?
Type Coercion is the process of converting a value from one data type to another data type either automatically or implicitly by the JavaScript Coding Engine during the code execution.
30
What is the negative side of piecing together complex strings with the + operator?
The negative side of piecing together complex strings with the + operator is that it could lead you with unwieldy expressions.
31
Which Mechanism provides support for managing strings made up of variables?
Template Literals are a Mechanism used for managing strings made up of different variables.
32
Why does piecing together complex strings with the + operator lead to unwieldy expressions?
It can quickly become messy, especially with variables and new lines. Missing the + operator, a space, or a quotation mark can lead to syntax errors and unexpected results. Using + for multi line strings can be clunky which is harder to edit and visually cluttered.
33
Should you use the Template Literal or the + Operator for Easy, Simple Strings that need to be combined?
You should use the + operator for combining strings that are easy and simple. You should use the Template Literal for combining strings that are more complex.
34
What is the third quotation mark that can be used to write a string?
A backtick is the third quotation mark that can be used to write a string.
35
Which notation are variables placed inside during the process of Template Literal?
The backtick notation is used.
36
Where is the Template Literal demonstrated in - const player = 'Alexandra' const team = 'Red' const description = `${player} is in the ${team} team!`
The template literal is demonstrated in - `the backticks being used.
37
What is the placeholder symbol in Template Literal?
The Placeholder symbol in the Template Literal Process is ${}. Variables are placed inside the placeholder.
38
What is it sometimes called when Strings are conducted with 'Placeholders' for variables?
It is sometimes called Interpolation.
39
What is Interpolation?
The process of embedding variables and/or expressions inside of a string to create a dynamic output.
40
How do you achieve Interpolation using JavaScript?
You use Template Literals to achieve Interpolation in JavaScript.
41
What is the Index?
The Index is the position of a piece of data.
42
What is Indexing useful for?
Indexing is useful for searching and sorting data.
43
How can you use Indexes in a string?
In a string, you can use indexes to identify the character at any given position.
44
What number do Indexes in JavaScript start at?
Indexes in JavaScript start at the number zero.
45
What kind of Indexed are Strings?
Strings are zero-indexed because the first character is indexed at 0 and then counts upwards.
46
What index positions do the characters in a five letter string have?
0,1,2,3,4 are the index positions for the five letters within a five letter string.
47
Which Syntax is used in JavaScript to access the characters in a string?
The [] square bracket syntax is used for accessing a character within a string. You place the characters Index Position within the square bracket syntax.
48
Which character will be evaluated in: const greeting = hello const firstCharacter = greeting[o]
'h' will be the character evaluated
49
Which character will be evaluated in: const greeting = hello const secondCharacter = greeting[1]
'e' will be the character evaluated
50
What would happen if we tried to access the character at a position greater than the number of characters in a string?
You would come across the undefined data type.
51
What does 'undefined' represent?
'undefined' represents data that cannot be found.
52
What can we think of 'Property' as?
We can think of Property as being a way to access more information about a piece of data.
53
What Property do Strings have?
Strings have the Length Property
54
What can we use a String's Length Property for?
We can use the length property to identify how many characters there are in a string.
55
What syntax is used in order to use a Property?
Dot notation syntax is used = .
56
What is a common reason for using the length property in JavaScript?
A common reason for using the length property in Javascript is to access the last character in a string without knowing the length of the string as we write the code.
56
Where is the Property Syntax in: const exampleLength = example.length
the Property Syntax is demonstrated in the dot notation syntax in - "example.length"
57
How do you use the length property to access the last character in a string without knowing the length of the string as we write the code?
You write the variable of the string followed by the variable.length - 1 wrapped in square bracket notation.
58
What are Methods?
Methods are Actions that can be performed on data.
59
How do you capitalise all characters within a string to become UpperCase?
you attach the dot notation syntax before writing toUpperCase followed by parantheses ()
60
How do you capitalise all characters within a string to become LowerCase?
you attach the dot notation syntax before writing toUpperCase followed by parantheses ()
61
What is the difference between the syntax used for using a method and the syntax used for accessing it's property?
They are similiar because they both use dot notation syntax however because methods are a function they require parantheses () to use them.
62
What is Parantheses?
()