Cartesian product of javascript object with different types of values like string, object and array
问题 I am working on an assignment. I have the following object form. { name: "name here", skills: [ "cash", "shares" ], subjects: [ { subName: "subject1", remark: ['remark1', 'remark2'] }, { subName: "subject2", remark: ['remark1', 'Hockey'] } ] } I want to generate a Cartesian product of the properties so that the output is an array of the following form: [ { "name": "name here", "skills": "cash", "subjects": { "subName": "subject1", “remark”: “remark2” }}, { "name": "name here", "skills": "cash