Apparently the solution is

var frameArray= [];
frameArray.push("#FirstRoll");
frameArray.push("#SecondRoll");

But that is to add single elements to the array. If the input is [[2, 3],[4, 5],...] then the JSON object representation would be

{ "frames": [{"first": 2, "second": 3}, {"first": 4, "second": 5}, ... ] } 

However, there was another issue of not getting the correct response from the controller.

The issue here is that an empty array is created (i.e. frames) and on the 3rd line the value was pused to the empty Array. Although the the for loop was adding each element to the Array(i.e. frames) but when the response was created the recent input was replacing the previous input, because the JSON object bowlingData was holding temp data only. So no need to create any Array to increment multiple input result. Initial value would be hold by the browser and second input would be added in next submit.

Was

var frames = [];
$('#submitButton').click(function(e) {
frames.push([$("#FirstRoll").val(), $("#SecondRoll").val()]);
for (var ln = 0; ln < frames.length; ln++) {
    var temp = {
        "firstroll": $("#FirstRoll").val(),
        "secondroll": $("#SecondRoll").val()
    };
    bowlingData.frames.push(temp);
}

Should be

$('#submitButton').click(function (e) {

bowlingData.frames.push({
   "firstroll": $("#FirstRoll").val(),
   "secondroll": $("#SecondRoll").val()
});
Answer from PineCone on Stack Overflow
๐ŸŒ
W3Resource
w3resource.com โ€บ javascript-exercises โ€บ javascript-array-exercise-13.php
JavaScript array: Add items in a blank array and display the items - w3resource
// Initialize a variable 'x' with 0 var x = 0; // Initialize an empty array var array = Array(); // Function to add an element to the array function add_element_to_array() { // Get the value from the input with id "text1" and assign it to the ...
Discussions

javascript - How to create an empty array of a given size? - Stack Overflow
You can use both javascript methods repeat() and split() together. ... This code will create an array that has 10 item and each item is empty string. More on stackoverflow.com
๐ŸŒ stackoverflow.com
Add new value to an existing array in JavaScript - Stack Overflow
Using .push() is the better way to add to an array, since you don't need to know how many items are already there, and you can add many items in one function call. ... Save this answer. ... Show activity on this post. You can use the .push() method (which is standard JavaScript) More on stackoverflow.com
๐ŸŒ stackoverflow.com
Insert items in a blank array
Can someone please tell me, what am I doing wrong here? I want to insert new items in the array. var fruits = []; function enterRecords (fruit) { "use strict"; if (fruits === ''){ return fruits.push(fruit); }else{ return 'records already updated'; } }; console.log(enterRecords('Kiwi')); More on forum.freecodecamp.org
๐ŸŒ forum.freecodecamp.org
14
0
April 29, 2020
How to initialize empty array of objects?
const arr: {name: string}[] = [] Maybe like this? More on reddit.com
๐ŸŒ r/typescript
14
18
May 27, 2021
๐ŸŒ
Sololearn
sololearn.com โ€บ en โ€บ Discuss โ€บ 1742669 โ€บ how-to-create-empty-array-in-javascript-and-insert-the-values-after
How to create empty array in JavaScript and insert the values after | Sololearn: Learn to code for FREE!
March 31, 2019 - You can create an empty array as var arrayName= []; and then to insert value in array you have many choices as 1. Using for loop for(var i= 0; i<noOfElements; i++){ arrayName.push("value"); } 2.
๐ŸŒ
Arnab Ghosh
blog.arnabghosh.me โ€บ javascript-create-empty-array
How to Create an Empty Array in JavaScript? [2 ways]
November 27, 2022 - Creating an empty array of objects is a two-step process. You have to use the array.push() method to add an item to the end of an empty array.
๐ŸŒ
freeCodeCamp
forum.freecodecamp.org โ€บ curriculum help
Insert items in a blank array - Curriculum Help - The freeCodeCamp Forum
April 29, 2020 - I want to insert new items in the array. var fruits = []; function enterRecords (fruit) { "use strict"; if (fruits === ''){ return fruits.push(fruit); }else{ return 'records already updated'; } }; console.log(enterRecords('Kiwi'));
Find elsewhere
๐ŸŒ
Altcademy
altcademy.com โ€บ blog โ€บ how-to-create-an-empty-array-in-javascript
How to create an empty array in JavaScript - Altcademy.com
August 24, 2023 - It's like a shopping list you haven't written anything on yet, or a bookshelf you've just bought and haven't put any books on. To create an empty array in JavaScript, you can use the following syntax: ... In this example, emptyArray is an array with no items. It's as simple as that! But why would you want to create an empty array? Good question! There are many scenarios where you might want to start with an empty array. For example, you might want to dynamically add items to an array based on user input.
๐ŸŒ
Medium
medium.com โ€บ @ryan_forrester_ โ€บ empty-arrays-in-javascript-how-to-guide-f8643da412c2
Empty Arrays in JavaScript (How to Guide) | by ryan | Medium
October 30, 2024 - Choose the appropriate method for the operation you want to perform, such as push for adding elements and splice for removing elements. const array = []; array.push(1); array.push(2); array.splice(0, 1); console.log(array); // Output: [2] Working with empty arrays in JavaScript is a fundamental skill that involves creating, checking, and manipulating arrays efficiently.
๐ŸŒ
sebhastian
sebhastian.com โ€บ create-empty-array-javascript
Create empty array with JavaScript | sebhastian
May 31, 2021 - The first way is that you can get an empty array by assigning the array literal notation to a variable as follows: let firstArr = []; let secondArr = ["Nathan", "Jack"]; The square brackets symbol [] is a symbol that starts and ends an array ...
๐ŸŒ
Quora
quora.com โ€บ How-do-you-declare-an-empty-array-in-JavaScript
How to declare an empty array in JavaScript - Quora
Answer (1 of 19): You have two main ways to go: simple declaration with square brackets. const myArray = [] Or instantiation of the Array Object using the constructor method: const myArray = new Array() The trendy kids favor the first way, nowadays, with the empty square brackets, but if you h...
๐ŸŒ
TechFliez Academy
techfliez.com โ€บ javascript-empty-array
How to Create Empty Array in JavaScript? - TechFliez Academy
January 1, 2025 - ... You can create an array through the Array Constructor. ... You can use the push() method to add a value to an Empty Array. ... There are many methods to remove all elements from the Array.
๐ŸŒ
W3Schools
w3schools.com โ€บ js โ€บ js_arrays.asp
JavaScript Arrays
JavaScript has a built-in array constructor new Array(). But you can safely use [] instead. These two different statements both create a new empty array named points:
๐ŸŒ
W3Schools
w3schools.com โ€บ jsref โ€บ jsref_array_new.asp
JavaScript new Array Method
Create an empty array and add values: // Create a new Array const cars = new Array(); // Add Values to the Set cars.push("Saab"); cars.push("Volvo"); cars.push("BMW"); Try it Yourself ยป ยท Create an array from a literal: // Create a new Array const cars = new Array(["Saab", "Volvo", "BMW"]); Try it Yourself ยป ยท
๐ŸŒ
Just Academy
justacademy.co โ€บ blog-detail โ€บ how-to-declare-empty-array-in-javascript
How to Declare Empty Array in JavaScript by Roshan Chaturvedi | JustAcademy
April 23, 2024 - 1 - Use the square brackets notation: You can declare an empty array in JavaScript using square brackets as follows: `let emptyArray = [];`. This creates a new array with no elements.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ javascript โ€บ create-an-array-of-given-size-in-javascript
Create an Array of Given Size in JavaScript - GeeksforGeeks
The for loop is used to repeatedly execute the given code untill the condition turns false and, the array.push() method is used to add one or more elements at the end of an array.
Published: July 23, 2025
๐ŸŒ
daily.dev
daily.dev โ€บ home โ€บ blog โ€บ webdev โ€บ js create array of objects: simplified
JS Create Array of Objects: Simplified | daily.dev
May 25, 2026 - By now, you've learned quite a bit about working with arrays of objects in JavaScript. Let's go over what we've covered: Creating empty arrays - You know how to start with an empty array like let cars = [] and get it ready to fill with objects. Adding objects to arrays - You've seen how to add objects, such as {make: "Toyota"}, to your array using .push().
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ article โ€บ create-empty-array-of-a-given-size-in-javascript
Create empty array of a given size in JavaScript
March 15, 2026 - After creating an empty array, you can assign values to specific positions or replace the entire array. var numberArray = new Array(6); console.log("Initial length:", numberArray.length); // Assigning new array values numberArray = [10, 20, ...
๐ŸŒ
Medium
allaboutcode.medium.com โ€บ javascript-how-to-create-and-fill-an-empty-array-with-a-given-size-ed6954355a5f
JavaScript โ€” How to create and fill an empty array with a given size? - Marika Lam - Medium
November 17, 2022 - JavaScript โ€” How to create and fill an empty array with a given size? Solution const arr = Array(5).fill(""); console.log(arr); //prints out ["","","","",""] console.log(arr[0]); //prints out "" 1) โ€ฆ
๐ŸŒ
Medium
medium.com โ€บ @wisecobbler โ€บ 4-ways-to-populate-an-array-in-javascript-836952aea79f
4 Ways to Populate an Array in JavaScript | by Sophia Shoemaker | Medium
December 5, 2018 - As Iโ€™ve worked on writing some chapters and editing the book I came across some gotchas in working with arrays in JavaScript. There are a few different options for creating an array and filling it with default values in JavaScript, and this blog post explains the pros and cons of each option.