Number of keys in object?

This is a tricky one for me:
Instructions:

Write a function named growingKeys that takes a number and a string and creates that many number of new keys according to the following example. The values for all of the keys will just be true.

Example:

If you pass 2,"d" it should return {"d": true, "dd": true}

My code:

function growingKeys(num, str) {
    let obj = {};
    
    for(let i = 0; i <= num; i++) {
        let letter = str.repeat(i);
        obj[letter] = true;
    }
    
    return obj;
};

EDIT: Nevermind, solved:

function growingKeys(num, str) {
    let obj = {};
    let emptyStr = '';
    
    for (let i = 0; i < num; i++){
        if (num === 1){
            obj[str[i]] = true
        } else {
            emptyStr += str;
            obj[emptyStr] = true
        }
    }
    
    
    return obj;
}