Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input){
- let ObjectProduct='';
- let ArrProducts={};
- for (const product of input) {
- ObjectProduct= JSON.parse(product);// in Object
- let entries= Object.entries(ObjectProduct);
- let NewObject={Term:'', Definition:'' };
- for (let[key,value] of entries) {
- ArrProducts[key]=value;
- }
- }
- let FinalArr=Object.entries(ArrProducts).sort((a, b) => a[0].localeCompare(b[0]));
- for (const [key,value] of FinalArr) {
- console.log(`Term: ${key} => Definition: ${value}` );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement