Week 3 Flashcards

(18 cards)

1
Q

is a block of code designed to perform a particular task.

A

JavaScript Function

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

It is executed when it is invoked (called) and can take parameters (inputs) and return a result (output).

A

JavaScript Function

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

help organize and reuse code by encapsulating logic in a reusable unit.

A

Functions

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

Function Declaration

A

function greet(name) {
return Hello, ${name}!;
}

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

Function Expression:

A

const greet = function(name) {
return Hello, ${name}!;
};

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

Arrow Function

A

const greet = (name) => Hello, ${name}!;

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

Returning a Value:

A

function add(a, b) {
return a + b;
}

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

Returning Multiple Values: (Using an Object or Array)

A

function getPerson() {
return {
name: ‘Alice’,
age: 25
};
}

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

No Return Statement:

A

function logMessage(message) {
console.log(message);
}

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

Defining Object Properties:

A

let person = {
name: ‘John’,
age: 30
};

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

Dot Notation:

A

let name = person.name;

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

Bracket Notation:

A

let age = person[‘age’];

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

Defining Methods in Objects:

A

let person = {
name: ‘John’,
greet() {
return Hello, ${this.name}!;
}
};

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

Accessing Methods:

A

console.log(person.greet());

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

Defining Nested Objects:

A

let person = {
name: ‘John’,
address: {
street: ‘123 Main St’,
city: ‘Anytown’
}
};

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

How to access nested properties

A

let city = person.address.city;

17
Q

is a lightweight format for data interchange.

A

JSON (JavaScript Object Notation)

18
Q

Commonly used to transmit data between a server and web application.

A

JSON (JavaScript Object Notation)