Created
December 17, 2024 00:49
-
-
Save andimariadi/aa69e7eb00cbae9ed10646c35e2bcc36 to your computer and use it in GitHub Desktop.
MSSQL dan MySQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mssql = [ | |
{name: "DT001", type: "Komatsu HD1500"}, | |
{name: "DT002", type: "Komatsu HD1500"}, | |
{name: "DT003", type: "Komatsu HD1500"}, | |
{name: "DT004", type: "Komatsu HD1500"}, | |
{name: "DT005", type: "Komatsu HD1500"}, | |
{name: "DT006", type: "Komatsu HD1500"}, | |
{name: "DT007", type: "Komatsu HD1500"}, | |
{name: "DT008", type: "Komatsu HD1500"}, | |
{name: "DT009", type: "Komatsu HD1500"}, | |
{name: "DT010", type: "Komatsu HD1500"}, | |
] | |
const mysql = [ | |
{name: "DT001", type: "Komatsu", location: "Jakarta", pit: "CENTRAL"}, | |
{name: "DT002", type: "Komatsu", location: "Jakarta", pit: "CENTRAL"}, | |
{name: "DT003", type: "Komatsu", location: "Jakarta", pit: "CENTRAL"}, | |
{name: "DT004", type: "Komatsu", location: "Jakarta", pit: "CENTRAL"}, | |
]; | |
let dataMysql = []; | |
for (let index = 0; index < mssql.length; index++) { | |
const element = mssql[index]; | |
let x = {}; | |
x['name'] = element.name; | |
x['type'] = element.type; | |
x['location'] = ''; | |
x['pit'] = ''; | |
for (let index2 = 0; index2 < mysql.length; index2++) { | |
const element2 = mysql[index2]; | |
if (element.name == element2.name) { | |
x['location'] = element2.location; | |
x['pit'] = element2.pit; | |
} | |
} | |
dataMysql.push(x); | |
} | |
console.log(dataMysql); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment