Basic JavaScript Instructions Flashcards

1
Q

textContent vs. innerHTML

A

textContent outputs text/plain while innerHTML outputs text/html

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

Statement

A

A statement is an individual instruction that the computer should follow. Each one should start on a new line and end with a semicolon.

The semicolon also tells the JavaScript interpreter when a step is over, indicating that it should move to the next step.

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

Code Block

A

Some statements are surrounded by curly braces; these are known as code blocks. The closing curly brace is not follow by a semicolon.

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

Variable

var quantity = 3;

Data Types

A

A temporary storage of information

keyword, name, assignment operator, value;

numbers, strings, booleans

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

Array

Literal vs. Constructor

A

An array is a special type of variable that stores a list or a set of values that are related to each other.

var colors = [“white”, “black”, “custom”];

var colors = new Array(“white”, “black”, “custom”);

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

Expression

A

An expression evaluates into (results in) a single value.

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

Operators

Types

A

Expressions rely on things called operators; they allow programmers to create a single value from one or more values.

assignment

  • color = “beige”;

arithmetic

  • area = 3 * 2;

string

  • greeting = “Hi “ + “Molly”;

comparison

  • buy = 3 > 5;

logical

  • buy = (5 > 3) && (2 < 4);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly