Forum Discussion
NisHera
7 years agoValued Contributor
function twoDimArrays() { var vehicals = [["Toyota", "Nissan","Volvo"],["Honda","Yamaha","Halidavidson"]]; Log.Message(vehicals[1][1]); }
https://stackoverflow.com/questions/966225/how-can-i-create-a-two-dimensional-array-in-javascript
- morantol7 years agoNew Contributor
Thanx but I didnt mean to matrix... I need to create an array with value=0 and insert the value at a specific index.
How do iI first create the array and how can I insert value to the specific index?
- tristaanogre7 years agoEsteemed Contributor
Check out below... basic JScript/JavaScript array operations.
function demoArray(){ var myArray = []; myArray.length = 5; // sets the array to have 5 elements myArray[2] = 0; // sets the 3rd element (with index of 2) to value of 0 }
Might be worth checking out https://www.w3schools.com/js/js_arrays.asp and related links... I know it says "JavaScript" but JScript is just, for all intents and purposes, an old version of JavaScript.
Related Content
- 5 years ago