Delete first character of a string in Javascript

前端 未结 14 1591
名媛妹妹
名媛妹妹 2020-11-28 01:01

I want to delete the first character of a string, if the first character is a 0. The 0 can be there more than once.

Is there a simple function that checks the first

14条回答
  •  臣服心动
    2020-11-28 01:36

    You can do it with substring method:

    let a = "My test string";
    
    a = a.substring(1);
    
    console.log(a); // y test string
    

提交回复
热议问题