Add a string to a key?

Add a string to a key?
0

#1

A bit confused with this one because I’m not sure if I’m adding strings or not.

Write a function named addSignature that takes a name and an object, and returns an object where

the keys are suffixed with “-signed”
the values are suffixed with " - "
Example:

If you pass “Fred”, {“contract”: “foo”} it should return {“contract-signed”: “foo - Fred”}

function addSignature(str, obj){
    let result = {};
    
    for (let i in obj){
        
    }
    
    
    return result;
};

#2

Nevermind, solved it:

function addSignature(str, obj){
    let result = {};
    let signed = "-signed"
    
    for (let i in obj){
        result[i + signed] = obj[i] + ' - ' + str;
    }
    
    
    return result;
};