BananaMaster

12.2 - innerHTML, input, select, value, querySelector, function, onclick, += (JavaScript) | JS lessons

If you forgot something — click to go to the lesson.

Task 1.

What will be the value and data type of this expression?

'$' + 1 + 2

Task 2.

What will be the value and data type of this expression?

'10px' - '1px'

Task 3.

What will be the value and data type of this expression?

'10' - '2'

Task 4.

Create an h2 element and a button. When the button is clicked, display the result of the expression "10 + 20" inside the h2. The expected result is "30".

Task 5.

Create a button and a select with options "red" and "green" (the option text must match the values). When a color is selected, update the button’s color accordingly.

Task 6.

Create three inputs with type="number" and a button. When the button is clicked, log the average of the three numbers to the console. Formula: (inp1 + inp2 + inp3) / 3

Input i_6_1
Input i_6_2
Input i_6_3

Task 7.

Create an input with type="number" for monthly income and a select with options: 1, 3, 6, 9, 12 months. The user enters their monthly income and selects the number of months. When the button is clicked, calculate the total income for the selected period and display the result in a div.

Monthly income: Number of months: