I need to convert list of strings
const ar: string[] = ['str1', 'str2']
to a string which contains ar
container with square brackets []
and quotes "
const str: string = `["str1", "str2"]`
how to do it in proper way?
I need to convert list of strings
const ar: string[] = ['str1', 'str2']
to a string which contains ar
container with square brackets []
and quotes "
const str: string = `["str1", "str2"]`
how to do it in proper way?
The format you want is a JSON array string. So use the JSON object's stringify function.
JSON.stringify(["some", "array", 123]);