cara menyiapkan kunci dalam objek dyamcally javascript

function resolve(path, obj) {
    return path.split('.').reduce(function(prev, curr) {
        return prev ? prev[curr] : null
    }, obj || self)
}
Obedient Okapi