JS to remove the first character and the last character of the implementation code

  • 2020-03-30 02:05:23
  • OfStack

There is a string "[lightinthebox]", but I just need the lightinthebox, not the []. How to get rid of it in a quick and effective way.
StringObject. Substring (start,stop) // intercepts the start and end strings.
StringObject. Substr (start,length) // intercepts the start and string length.
So let's think about all of these, the linkage of the sum method.
StringObject. Substr (1). Substring (-1,0) // will work
I'm just going to say a intercept here, by the way, and now there's always the temptation to change the ones place to two places. For example, 9 is displayed as 09 for formatting alignment.
A lot of things are done to see if this number is less than 10, to see if we can add a 0
If we use a string, we don't have to judge anything, we just add one bit, we just cut out the last two bits, and then 01,010,011 becomes 01, 10, 011

Related articles: