Sorry, a little new to this. But I am trying to achieve the following. I have this (the fullName string is returned from a webapp UI using selenium webdriverIO):
const fullName = "Mr Jason Biggs";
And need it to look like this:
title: 'Mr',
name: 'Jason',
surname: 'Biggs',
I tried splitting the name, but not sure how to add a k to the v
const splitName = fullName.split(" ");
// But returns as [ 'Mr', 'Jason', 'Biggs' ]
arr = ['Mr', 'Jason', 'Biggs'].beautiful_name = { title: arr[0], name: arr[1], surname: arr[2] }{ title:splitName[0], name:splitName[1], surname:splitName[3] }JSON.stringify