I was wondering how to convert an array to an object by splitting the values ?
var obj = {
id: '',
val: ''
}
By this I mean - if I have an array like
["abc12", "abc1", "def12", "abc454"]
How I could split the first 3 values off - so it end up like an object like:
{id: 'abc', val: 12}, {id: 'abc', val: 1} ...
[{id: 'abc', val: 12}, {id: 'abc', val: 1} ...]- and do you want to split exactly on three characters, or perhaps split based on letters versus digits?