Roman numeral help

So after multiple tries by myself on this challenge I gave up and looked for answers online.
I’ve been seeing a lot of different solutions for this and after seeing a couple that seemed too long, I managed to find one that looked fairly simple.

function convertToRoman(num) {
  var roman = {
    M: 1000,
    CM: 900,
    D: 500,
    CD: 400,
    C: 100,
    XC: 90,
    L: 50,
    XL: 40,
    X: 10,
    IX: 9,
    V: 5,
    IV: 4,
    I: 1
  var str = '';

  for (var i of Object.keys(roman)) {
    var q = Math.floor(num / roman[i]);
    num -= q * roman[i];
    str += i.repeat(q);

  return str;

So I’ve been studying this but am a bit confused on this part.

str += i.repeat(q);

The loop seems to skip this part whenever q = 0. Why does it do that? For the first iteration, since Math.floor(999/1000) = 0 the num variable doesn’t change (which I understand) but the str variable doesn’t either, which I don’t get.

Any help would be much appreciated.

Take str and add to it i repeated 0 times (string repeated 0 times is an empty string).

Oh that clears things up a bit.
Thanks a lot!