BananaMaster

12.1 - 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?

3 * '2'

Task 2.

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

'-1' + 2

Task 3.

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

'lolo' - 'lo'

Task 4.

Create a div with the text "LO" and a button. On each button click, append the letter "O" to the text using JavaScript. The result should grow like this: "LO" → "LOO" → "LOOO" → "LOOOO". (Use full syntax.)

LO

Task 5.

Create an input and a button. When the button is clicked, display the entered number multiplied by 10.

Input i-5

Task 6.

Create a div. Assign it to a variable (out6). Using innerHTML, insert the following HTML string:

<img src="https://cdn4.iconfinder.com/data/icons/food-and-drink-flat-gradient/32/cone_ice_cream_food_drink_sweet-512.png" alt="">

Note: the string contains quotes, so make sure to alternate them correctly. Wrap the entire string in single quotes when inserting it.

Task 7.

Create a button with the initial value "1". On each click, increment its value by 1 (click counter).