Hello, I am trying to set progress bar width with percentage value min 0% max 100%, using an object, my object value is between 0 and 100.
var divArray = document.getElementById(‘progressBar’);
divArray.style.width = ‘22%’;
This will work because I set width with a number 22%, and it set width to 22%, how can I achieve this with something like:
divArray.style.width = myObj.player.experience;
where player.experience is equal to = 22… I will try to set my experience to a string like ‘22%’ that might work, but I am not sure about that.
@EDIT:
Hey, I found a solution, for someone who might need it, here it is:
divArray.style.width = ((exppercent2) + ‘%’);