js-munich-2020-spring

Lesson 9 Classwork

Let’s practive all what we know about functions

Spec

Build a car speed calculator with following properties:

  1. Distance and time should be entered by user
  2. Calculation should happen after user press “Calculate” button
  3. Get user input with a separate function and return it as an object
  4. Speed should be calculated in a separate function and return the value
  5. Result should be presented in the following way:
    • Given data: distance = 30, time = 1
    • Speed of a car is: 30km/h
  6. Above structure should be created by a separate fucntion

Tips

  1. You need 2 input fields and one button
  2. div element to display resulted structure
  3. Use function with return statement and parameters

More practice

Build a converted from Celsius to Fahrenheit Formula: (C * 9/5) + 32 User should be able to imput a value in Celsius.

Bonus

Continue to work with books store example from previous lessons. Create a possibility for a user to add books into the store. For that you would need some input fields (to enter book name, author, year and price for ex.), button and some functions to work with this data. Use all your knowlage from all lessons.