I must do this: to work over string that i will ask to some user:
text = "";
arr = ["*****"];
arr2 = [];
text = arr.toString();
for(i=0; i<text.length; i++) {
arr2.push(text[i]);
}
---> arr2 = [*,*,*,*,*] <--- thats what i want!.
But i must work with a lot of data like this, so i created and array to content that structured data:
var gems = [
{
name: 'Level-1',
row: {
r1: '*****',
r2: '-***-',
r3: '--*--'
},
canPushtoDb: true,
hideLevel: false,
status: 1
//canvas
},
{
name: 'Level-2',
row: {
r1: '**-**',
r2: '-*-*-',
r3: '-***-',
},
canPushtoDb: true,
hideLevel: false,
status: 1
//canvas
},
{
name: 'Level-3',
row: {
r1: '*-*-*',
r2: '**-**',
r3: '*-*-*'
},
canPushtoDb: true,
hideLevel: true,
status: 1
//canvas
}
];
I want to loop within gems to convert that string on some kind of array, just like I wrote on the beginning of this question.
I was looking on an Angular example, which wrap those objects with a controller.
But for now I'm far to get my code on some refactored version of his own. I just need some hard-coded function or method likegems.name[0].row.r1(this is not working to me!) to get out the object all that I'm working on.
gems[0].row.r1notgems.name[0].row.r1gems[0].row.r1. To create array from string's characters:var arr = str.split('');array.fill.var arr2 = new Array(tet.length).fill('*')