how to push array object name javascript

Solutions on MaxInterview for how to push array object name javascript by the best coders in the world

showing results for - "how to push array object name javascript"
Lilli
22 Nov 2018
1function getKeyValue(object) {
2    return Object.keys(object).reduce(function (result, key) {
3        return result.concat(
4            object[key] && typeof object[key] === 'object' ?
5            getKeyValue(object[key]) :
6            [[key, object[key]]]
7        );
8    }, []);
9}
10
11var data = { id: 23, name: "Jacob", link: { rel: "self", link: "www.abc.com", }, company: { data: { id: 1, ref: 324 } } };
12
13console.log(getKeyValue(data));