I'm trying to create a comparison between an array of keys and an array of arrays. The array of array contains the data as the follwing:
const data = [
[["id", 1], ["name", "somethign"], ["age", 20]],
[["id", 20], ["name", "somethign"]],
[["id", 9], ["age", 10]]
]
An the array with keys, that will always have all the keys I need.
const keys = [
"id",
"name",
"age",
"nothing"
]
But as you can see in data array, not always all the keys come in the array, what I was attempting to do was, make a comparison between both arrays an add that key that is missing into the data array (in order) as undefined, for example (final result):
const data = [
[["id", 1], ["name", "somethign"], ["age", 20], ["nothing", undefined]],
[["id", 20], ["name", "somethign"],["age", undefined] ["nothing", undefined]],
[["id", 9], ["name", undefined], ["age", 10], ["nothing", undefined]]
]