Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let str = "2x PCI-e 4.0 x1, 2x PCI-e 4.0 x16";
- let objects = str.split(", ");
- let result = {};
- objects.forEach(o => {
- let o2 = o.split("x ");
- let amount = Number(o2.shift());
- result[o2.join("")] = amount;
- });
- console.log(result);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement