Is there a splice method for strings?

前端 未结 10 2384
你的背包
你的背包 2020-11-30 23:32

The Javascript splice only works with arrays. Is there similar method for strings? Or should I create my own custom function?

The substr(),

10条回答
  •  失恋的感觉
    2020-12-01 00:08

    Simply use substr for string

    ex.

    var str = "Hello world!";
    var res = str.substr(1, str.length);
    

    Result = ello world!

提交回复
热议问题