1const img = document.querySelector('img');
2//Width and height values must be integers
3//Width and height are measured in pixels (px)
4img.width = 128;
5img.height = 128;
6//To use other type of measeures (% em) style should be edited
7//In this case it has to be a string
8img.style.width = '10em';
9img.style.height = '10em';
10
11//Resize by input (min = 0; max = 100)
12//Event mousemove is for a fluent effect
13const range = document.querySelector('input[type=range]');
14range.addEventListener('mousemove', evt => {
15 img.style.width = evt.target.value + '%';
16});
17