I have array which values look like this in image
I need to convert in one arry like { "1vwxnrjq", "dasdada", "adsdadsada"} like this
console.log(items);
this.ids = items.id;
console.log(this.ids);
I am doing like this but its showing undefined
You can do it like follows, first convert all into lowercase and then pick the length of substring you want. From below you can replace 9 with a variable value to get the length of substring you want.
temp = arr.map((item)=>{
return item.id.toLowerCase().substr(0,9);
})
Working snippet:
arr = [{id:"dafSDFdDfdafd"},{id:"adfdDFAsssd"},{id:"12adfdDFAsssd"}];
temp = arr.map((item)=>{
return item.id.toLowerCase().substr(0,9);
})
console.log(temp);