Exercises 1 : JavaScript Basics 1 (16p)
Remember use JAMK/GitLab to return your exercises. Student need to test that exercise really work.
Exercise 01 - variables [2p]
Create HTML-file which include JavaScript. Define let v1 = "Hello"
and let v2="World!"
variables. Your application should create a new string based variable (name it result
) which uses these two variables like this <h1>Hello World!</h1>
. Add a new p
element to your HTML and give some unique id
for it. Use getElementById
and .innerHTML
to show your results
varaible content in Web page. Use also console.log()
to display your result
value in Web browser's console.
Return: You should have one HTML file.
Exercise 02 - js.bin [2p]
Test above code in jsbin.com and some other playgournd. Save a screenshots.
Return: Screenshots about working code in jsbin.com and some other playground.
Exercise 03 - array [2p]
Define an array, which has a following values: ["JavaScript", "is", "excellent!"]
. Create a sentence JavaScript is excellent!
from your array data using a some loop in JavaScript. Display a created sentence in web console.
Return: HTML/JS files.
Exercise 04 - functions [2p]
Create a function which will take a three number based parameters. Function should display the biggest number. First create a three variables (you can define any numbers) and display those number values to web browser console. Call your function and display the biggest value.
Return: HTML/JS files.
Exercise 05 - functions [4p]
Create a function, which will take an array of integer values as parameter. Function should find numbers which are even and which are odd numbers. Function should dipslay first the original array and then array only with odd numbers. You can use console.log()
to display values.
Return: HTML/JS files.
Exercise 06 - loops [4p]
Create HTML and JavaScript file where you define following variables
1 2 3 4 5 |
|
Calculate count
and sum
values with for of
loop. Create lines
variable contents with for
loop.
1 2 3 4 5 6 7 8 9 10 11 |
|
Your application should display:
1 2 3 4 5 6 7 8 |
|
Note
You can use .toFixed() to round your display values.