Javascript replace method, replace with “$1”

前端 未结 2 1410
别跟我提以往
别跟我提以往 2020-12-12 21:47

I\'m reading Sitepoints 2007 book \"Simply Javascript\" and I encountered some code I just can\'t understand.

It\'s the following code:

Core.removeCl         


        
2条回答
  •  庸人自扰
    2020-12-12 22:38

    $1 is a backreference. It will be replaced by whatever the first matching group (set of parenthesis) in your regex matches.

提交回复
热议问题