Create a dynamic object using javascrip

Hello Everyone,

Would any of you kindly assist with the following issue below:

I have:

var AssessmentQuestionObject = [
  { 
    AssessmentID: '1',
    Title: 'Question title',
    corectOption1: 'Corect Option 1', 
    correctOptionNo2: 'Correct Option 2', 
    option1: 'Option 1', 
    optionNo4: 'Option 2', 
    optionNo5: 'Option 3' 
  },
];

I would like to create the object below using a function or any other mean necessary

var Question = [
  { Title: 'Question Title'
  ,assessmentId: '1'
  ,options:[
             {answer: 'Option 1', IsCorrect: false},
             {answer: 'Option 1', IsCorrect: false},
             {answer: 'Option 1', IsCorrect: false}
            ] 
    ,correctoptions:[
             {answer: 'Correct Option 1', IsCorrect: true},
             {answer: 'Correct Option 1', IsCorrect: true}
            ] 
  }
];

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

I’m not sure what you are asking for help with. In both snippets you have an array containing a single object.