Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
var matrix=[1,2,3,4,5,6,7,8,9]

What I have tried:

function(){
var x=document.getElementByTagName('input');
var y=x.length;
[x[0],x[2]]=[x[2],x[0]];
x.innerHTML=x;
}
Posted
Comments
Richard MacCutchan 12-Jul-20 11:27am    
Your matrix is 1 x 9, not 3 x 3.
PIEBALDconsult 21-Aug-20 12:29pm    
No, that's just a matter of encoding, a 3x3 matrix can be stored internally as a nine-element array.
Richard MacCutchan 22-Aug-20 3:21am    
True, as long as you understand where the boundaries are.

1 solution

 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900