I want to change a number to a string like this:
var i = slides.length*100;
i += '%';
el.style.height = i;
But I see that I could also do it all in one statement:
el.style.height = slides.length*100 + '%';
Is it ok to mix numbers and strings in a single statement like this? or should I avoid it?
It turns out mixing strings and numbers in this way is fine provided you understand operator precedence:
for example:
Hope that’s helpful