JSFiddle - React, Tailwind, and code Playground
JavaScript
function keysAndValues(data){
arrayOne = [];
arrayTwo = [];
for(keyValue in data){
if ( ! data.hasOwnProperty(keyValue)){ //checks for extended prototype
continue; //continues to next key value pair in "data"
}
arrayOne.push(keyValue); //places the key into one array
arrayTwo.push(data[keyValue]); //places the value into another
}
return [arrayOne, arrayTwo];
}