Some usage in JavaScript string

L_ nan. 2022-05-22 12:22:14 阅读数:504


substring(a,b) from a Start to b end ( barring b)a、b The size is random 'abcd'substring(3,1) --> bc
slice(a,b) from a Start to b end ( barring b)

Small numbers come first ( Otherwise, it will output null ' '         )

a It could be negative 'abcd'slice(-3,-1) -->bc 
substr(a,b) from a Start The length is b ( barring a)'abcd 'substr(1,3) -->bcd

copyright:author[L_ nan.],Please bring the original link to reprint, thank you.