Functions Training Flashcards

(6 cards)

1
Q

filter() and includes()

files.filter(file => videoFileTypes.includes(file.mimeType));

A

Only return the list items where it matches a certain value from this list.

Take the list that has required items and look at the properties where the comparison should take place

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

setInterval()

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

reduce()

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

How to generate sites from a sheet

A

Read the sheet data into a JSON object

Use that JSON object as a config

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

How did we build this customer map?

A

function buildCustomerAccounts() {
const customers = extractAllQboCustomers();
const invoices = extractAllQboCustomerInvoices();
const payments = extractAllQboCustomerPayments();

const customerMap = {};

customers.forEach(customer => {
customerMap[customer.Id] = {
customerId: customer.Id,
displayName: customer.DisplayName,
email: customer.PrimaryEmailAddr ? c.PrimaryEmailAddr.Address : “”,
invoices: [],
payments: [],
outstandingBalance: 0
};
});

invoices.forEach(inv => {
const custId = inv.CustomerRef.value;
if (!customerMap[custId]) return; // skip if customer not found

customerMap[custId].invoices.push({
  id: inv.Id,
  txnDate: inv.TxnDate,
  total: inv.TotalAmt,
  balance: inv.Balance
});

customerMap[custId].outstandingBalance += inv.Balance || 0;   });

payments.forEach(pmt => {
const custId = pmt.CustomerRef.value;
if (!customerMap[custId]) return;

customerMap[custId].payments.push({
  id: pmt.Id,
  txnDate: pmt.TxnDate,
  total: pmt.TotalAmt
});   });

debugger;

return customerMap;
}

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

How to merge these different groups together?

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