jeudi 2 juin 2016

js - two dimensional array pattern

Hey i'm tying to create the following pattern in javascript:

[1,2,3,4,5]
[2,1,2,3,4]
[3,2,1,2,3]
[4,3,2,1,2]
[5,4,3,2,1]

What's a efficient way to create this pattern in a for loop?

Aucun commentaire:

Enregistrer un commentaire