+ 1

Why this slider console is not working as it is supposed to

Set the value of slider to its minimum in one click and watch the console Why like that? https://code.sololearn.com/Wlc6bYnMHHgJ/?ref=app

24th Jun 2022, 5:09 AM
roshan roy
1 Answer
+ 1
let prevValue = slider.value; The type of slider.value is string instead of number. So you have to change type to number. You can convert strings to numbers using a unary plus operator as opposed to parseInt() or Number() let prevValue = parseInt(slider.value); let prevValue = Number(slider.value); let prevValue = +slider.value;
24th Jun 2022, 6:33 AM
Oleh Davydenko
Oleh Davydenko - avatar