Skip to content

rest-api-examples/arrayExample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

arrayExample

Harjoitellaan JavaScript kielen perusteita. Tarkoituksena on opiskella rakenteita, joita tarvitaan kun tehdään REST API sovellus Express-frameworkillä. Tässä käsitellään assosiatiivista arraytä, koska se muistuttaa tietokannan taulua.

  1. Luo assosiatiivinen array nimeltään bookArray, jossa on samat kentät kuin book-taulussa kts. https://peatutor.com/databases/library.php
  2. Tulosta konsolille mikä luomasi taulun "tietotyyppi" on (käytä JavaScriptin typeof-funktiota)
  3. Tulosta konsolille koko bookArrayn sisältö
  4. Tulosta konsolille bookArrayn ensimmäinen rivi
  5. Tulosta konsolille ensimmäisen kirjan nimi
  6. Tulosta konsolille arrayn rivien määrä
  7. Tulosta konsolille kaikkien kirjojen nimet

Let's practice the basics of JavaScript. The goal is to learn structures needed when building a REST API application using the Express framework. Here, we will work with an associative array because it resembles a database table.

  1. Create an associative array named `bookArray` with the same fields as the `book` table (see: https://peatutor.com/databases/library.php).
  2. Print to the console the "data type" of the table you created (use JavaScript's `typeof` function).
  3. Print the entire content of `bookArray` to the console.
  4. Print the first row of `bookArray` to the console.
  5. Print the name of the first book to the console.
  6. Print the number of rows in the array to the console.
  7. Print the names of all books to the console.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published