JavaScript Basics Flashcards

1
Q

What is JavaScript?

A

JavaScript is a powerful, flexible, and fast programming language used for interactive web development

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

Define the Console.

A

The console is a panel that displays important messages, like errors, for developers.

If we want to see things appear on our screen, we can print, or log, to our console directly.

Keywords are words that are built into the JavaScript language, so the computer will recognize them and treats them specially.

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

What is the purpose of a semi-colon in a line of code?

A

The semicolon denotes the end of the line, or statement.

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

Define a comment.

A

Comments can explain what the code is doing, leave instructions for developers using the code, or add any other useful annotations.

These comments exist just for human readers.

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

2 types of comment?

A

A single line comment will comment out a single line and is denoted with two forward slashes // preceding it.

A multi-line comment will comment out multiple lines and is denoted with /* to begin the comment, and */ to end the comment.

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

Name the 6 primitive data types.

A
Number
String
Boolean
Null
Undefined
Symbol
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Define a data type.

A

Data types are the classifications we give to the different kinds of data that we use in programming.

There are 7 fundamental types

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

What does the “string” datatype involve?

A

String: Any grouping of characters on your keyboard (letters, numbers, spaces, symbols, etc.) surrounded by single quotes: ‘ … ‘ or double quotes “ … “

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

What does the “Boolean” datatype involve?

A

Boolean: This data type only has two possible values— either true or false

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

What is the Null datatype?

A

This data type represents the intentional absence of a value, and is represented by the keyword null

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

What is the Undefined datatype?

A

This data type is denoted by the keyword undefined and represents an intentional absence

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

What is the Symbol datatype?

A

Symbol: A newer feature to the language, symbols are unique identifiers, useful in more complex coding.

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

What is the Object datatype?

A

Object: Collections of related data.

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

Define an operator?

A

An operator is a character that performs a task in our code.

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

What is an arithmetic operator?

A

Built-in arithmetic operators allow us to perform mathematical calculations on numbers.

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

Name 5 arithmetic operators.

A
Add: +
Subtract: -
Multiply: *
Divide: /
Remainder: %
17
Q

What is String Concatenation?

A

The process of appending one string to another. When a + operator is used on two strings, it appends the right string to the left string:

18
Q

Define a Method.

A

Methods are actions we can perform. JavaScript provides a number of string methods.

We call, or use, these methods by appending an instance with:

a period (the dot operator)
the name of the method
opening and closing parentheses

e.g. .startsWith()

19
Q

What does the Number datatype categorise?

A

Numbers are any number without quotes

20
Q

What is the dot operator?

A

We can access properties and methods by using the ., dot operator.

21
Q

What does the “Var” keyword do?

A

Short for variable, is a JavaScript keyword that creates, or declares, a new variable.

22
Q

What is camel casing?????????????

A

Camel casing is when you bunch words up together to form a string of code.

The first word is lowercase, the following is Capitalized

e.g. .startsWith()
.myName()

23
Q

Example of an assignment operator.

A

=

24
Q

What does the “Let” value do?

A

The let keyword signals that the variable can be reassigned a different value.

25
Q

What does the “Const” variable do?

A

A const variable cannot be reassigned because it is constant. If you try to reassign a const variable, you’ll get a TypeError.

26
Q

What does the increment operator do?

A

The increment operator will increase the value of the variable by 1. ++

27
Q

What does the decrement operator do?

A

The decrement operator will decrease the value of the variable by 1. –

28
Q

What is a variable?

A

Variables hold reusable data in a program and associate it with a name. Variables are stored in memory.

29
Q

What are Conditional Statements?

A

A conditional statement checks a specific condition(s) and performs a task based on the condition(s).

30
Q

What does the “if” conditional statement do?

A

It will perform an action based on whether a statement is true.

31
Q

What does the “else” conditional statement do?

A

It will perform an action based on whether a statement is false, as an alternative action.

32
Q

What are comparison operators?

A

Different types of operators used to compare values.

Comparison operators compare the value on the left with the value on the right. For instance:

10 < 12 // Evaluates to true

33
Q

Name 3 logical operators.

A

And (&&), or (||), not ( ! )