Q:

Slice characters from all array items

I have an array
myArray = ['A123000','A234000','A456000']

I want to slice out the first 4 characters from each array item, so the output looks like this:
['A123','A234','A456']

I tried this but it doesn't like array -  Am I missing an each or something? Help!
myArray.slice(0,3); 

A:

Use the same slice within map for each element
var output = myArray.map( s => s.slice(0,4) ) 

or with substring
var output = myArray.map( s => s.substring(0,4) ) 

