JS Definitions Flashcards

Introduction to Javascript: Definitions

1
Q

What is Programming?

A

telling the computer to manipulate data

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

What is a Variable?

A

named location for storing a value

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

What are Comments?

A

section of code that the computer ignores
i.e. for humans to read
//
/* comment */

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

What are Functions?

A

prime mechanism with which to manipulate data and usually returns a value

Functions are one of the fundamental building blocks in JS
A function is a JavaScript procedure, which is:
A set of statements that perform a task or calculate a value
A function definition (or declaration) consists of a function keyword, followed by:
The name of the function
A list of parameters to the function, enclosed in parentheses and separated by commas
The JS statements that define the function, enclosed in curly braces { }

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

What is Undefined?

A

Data type in Javascript

variable is not assigned to a particular value

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

what are Booleans?

A

logical value type

can be true or false

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

What are Numbers?

A

only one number type in JS,
positive, negative, integer, floating point (decimal)
+Infinity ; -Infinity ; NaN

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

What are some primary JS Operations / Operators?

A
\+ ; - ; * ; /
% Modulus (division remainder)
\++ Increment
-- Decrement
=
\+= ; -= ; *= ; /= ; %= ;
example x += y is x = x + y
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Explain Function vs Arguments

A
function addTwo(num) {
     return num + 2;
}
function "takes" as its parameter is num;
actual "call" to the function is addTwo(6)
6 is the "argument"
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a String?

A
primitive and scalar data type
stores a series of characters
"string is between quotes"
double or single quotes
index starts at 0
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the Primitive Data Types?

A

There are 6 primitive data types:

  1. Boolean — true or false
  2. Null — no value
  3. Undefined — a declared variable but hasn’t been given a value
  4. Number — integers, floats, etc
  5. String — an array of characters i.e words
  6. Symbol — a unique value that’s not equal to any other value
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the Collection Data Types?

A

arrays

objects

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

What is an Array?

A

The array is used to store an ordered list of multiple values in a single variable
Arrays are considered “objects” in JS

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

What is an Object?

A

An object is a collection of properties
A property is an association between a name (key) and a value (some data type)
A property’s value can be any of the types we have gone over, as well as being another object, or even a function
In the case where the value of a property is a function, we refer to the property as a method

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

What is typeof operator?

A

One very useful tool in programming is the typeof operator

Its functionality is rather simple, and when applied to a value, it will tell you the type of value in question

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

What is an Array.isArray?

A

a method to determine if a type is an array or an object

17
Q

What is an Operator?

A

An operator is used to perform specific computations or operations on operands
We have seen a few so far: =,+, -, and typeof
They can be unary: {operator} {operand} (e.g. typeof “username”), or:
They can be binary: {operand1} {operator} {operand2} (e.g. 4 + 5)
There are many more

18
Q

What is a Method?

A

A method is a function that is a property of an object
We have seen a few so far: console.log, and Array.isArray()
There are many more

19
Q

What are the falsy values?

A
  1. false
  2. 0
  3. ””
  4. null
  5. undefined
  6. NaN