Question
Checking last character
What would you consider being the best way to check the last character of a string?
var folderPath = '~/Desktop/Test';
if (folderPath[folderPath.length - 1] !== '/') { folderPath += '/'; }
or
if (folderPath.slice(-1) !== '/') { folderPath += '/'; }
I see that changePath() can also be used to keep track of this path separator.
Thanks.