I have an array of strings array ['one','two',three']
and would like to transform this into a key value pair so that it looks like (first element is the key and last element the value):
{
one:'three'
}
This is how far I've gotten:
function t(array) {
var key = array[0];
return {key:array[array.length-1]}
}
output:
{ key: 'three' }
The value is correct but the key is not displaying correctly.