Untitled

 avatar
unknown
javascript
3 years ago
613 B
4
Indexable
function inputVerify (target) {
    let input;
    do {
        input = prompt("Please Enter " + target +" :");
        console.log(input)
    } while (input !== null && input !== 'stop')
}   

let get = inputVerify('Username');

const createObj = () => {
    const obj = {}
    let key, val;
    do {
        key = prompt("Key :");

        if (key === 'stop') {break}
        
         val = prompt("Value :")
        
        if (val === 'stop') {break}
        
        obj[key] = val
        
    } while (key !== 'stop' && val !== stop)
    return obj;
}

let test = createObj();
Editor is loading...