Answers for "how to push array object name javascript"

0

how to push array object name javascript

function getKeyValue(object) {
    return Object.keys(object).reduce(function (result, key) {
        return result.concat(
            object[key] && typeof object[key] === 'object' ?
            getKeyValue(object[key]) :
            [[key, object[key]]]
        );
    }, []);
}

var data = { id: 23, name: "Jacob", link: { rel: "self", link: "www.abc.com", }, company: { data: { id: 1, ref: 324 } } };

console.log(getKeyValue(data));
Posted by: Guest on November-21-2020

Code answers related to "how to push array object name javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language