const dataParams = [];
let data={
A:'5',
B:'6',
C:'7',
D:'8'
}
for(let d in data){
dataParams.push(d + '=' + data[d]);
}
console.log(dataParams)
I have an object as below i just need to print it as an array like ["A=5", "B=6", "C=7", "D=8"]
The Below code is working please see the console.
But i have read about the keys and values method in JS
Object.keys(data) // [A,B,C,D] Object.values(data) // ['5','6','7','8']
Is there any way that i can get the same output with the help of using keys and values method