A club has the following members:
First name | Last name | Year joined |
---|---|---|
Jon | Snow | 2000 |
Arya | Stark | 2013 |
We are creating a calculator that can do three types of calculation:
double
functionhalve
functionsquare
functionComplete the functions so that calculate
takes one of the functions that implement an operation and a number as arguments, and returns the result of the calculation.
Using the GitHub API, figure out:
You should use the GitHub API reference at https://docs.github.com/en/rest/reference. Just enter the API URLs into the browser's address bar and inspect the returned JSON objects.
Open the Network tab in the browser's Developer Tools, copy-paste http://httpbin.org/get?org=CodeYourFuture&class=ldn7 into the browser's address bar and inspect the following:
/** | |
Exercise 1 | |
Rewrite the code below to use array destructuring instead of assigning each value to a variable. | |
*/ | |
{ | |
console.log("EXERCISE 1"); | |
let item = ["Egg", 0.25, 12]; |
/* | |
TEST RESULT GRADING | |
We are writing a program for teachers that helps them grade test results. | |
The program receives the test results as an array of objects; each object | |
contains the name of a student and their test score (see below). | |
1. Print the names and the number (the count) of the students who passed the test (had at least 40 points). | |
2. Print the average score. | |
3. Print the name of the student who had the highest score. |
/* | |
STORE ACCOUNTING | |
We are writing a program module for an online shop that processes purchases. | |
The program receives the sold items as an array of objects; each object | |
contains the name of the item, its price and its category (see below). | |
1. Print the names and the number (the count) of all sold homeware accessories. | |
2. Print the total revenue (the sum of the prices of all sold items). | |
3. Print the average price of the items. Make sure that the price is rounded to 2 decimal points. |
server.js
.server.js
that listens on port 3000.This exercise requires a working Postgres DB server with the homework
database from https://github.com/CodeYourFuture/SQL-Coursework-Week1/tree/main/2-classes-db.
homework
database with node-posgtres.GET /spends
endpoint that returns the list of all spends as a JSON array of objects. Each object should contain the date
, description
and amount
properties.GET /suppliers
endpoint that returns the list of the names of all suppliers as a JSON array of strings. Make sure the response is an array of strings and not an array of objects!GET /spends
endpont to return a more compete list of spends. Each object should contain the expense_area
, expense_type
, supplier
, date
, description
and amount
properties. The objects should not include any IDs, that is, the tables should be joined together.