Hi all,
I am trying to assign a file path to a variable in Typescript while in strict mode.
The path has numbers in it, particularly the date of creation prefixed.
The code is being executed in Node.JS.
This is the path:
const path = 'C:\\Software Development\\2020_12_21_NET_NodeJS\\NET_NodeJS_01';
error - [Octal escape sequences are not allowed in strict mode.]
My thought at that point was to break the string into elements of an array, then join the elements into the finished string.
const path_parts = [
'C:\\Software Development\\',
'2020_12_21_NET_NodeJS\\NET_NodeJS_01'
];
const path = path_parts.join ();
error - [Numeric separators are not allowed at the end of numeric literals]
Try again:
const path_parts = [
'C:\\Software Development',
'\\2020',
'_12', '_21_NET_NodeJS\\NET_NodeJS_01'
];
error - [Octal escape sequences are not allowed in strict mode.]
Try again:
const path_parts = [
'C:\\Software Development\\',
'2020',
'_12', '_21_NET_NodeJS\\NET_NodeJS_01'
];
error - [Unexpected number]
Try again:
const path_parts = [
'C:\\Software Development\\',
'2020',
'_', '12', '_21_NET_NodeJS\\NET_NodeJS_01'
];
error - [Unexpected number]
Remove the first element in the array, then try again:
const path_parts = [
'2020',
'_12', '_21_NET_NodeJS\\NET_NodeJS_01'
];
no error
Remove the trailing double-backslash in the first element
within last array, then try again:
const path_parts = [
'C:\\Software Development',
'2020',
'_', '12', '_21_NET_NodeJS\\NET_NodeJS_01'
];
no error
Any help would be appreciated!