I cannot recreate this behavior in the engine of the sn snippet of SO, but in Chrome (v46) I encounter a rather funny behavior of string manipulation.
Take a look at this screenshot of the Chrome JavaScript console:

In my opinion, the result of the slice should be ( Here . That is, a bracket, and then three spaces. Not a bracket, and then one space that it offers me.
I checked the same commands in Firefox that give the expected results:

Can anyone think of explaining the difference in output? Am i tight
Update
As for being a duplicate of this , I believe this question does two things differently:
- His request is much clearer
- He asks why the phenomena occur, and not how to solve the problem.
source share