RegExp.test returns false, even though it should return true

For example, this is my regular expression :
It used to check if string is in YYYY-MM-DD form.
I used code as below at first, and found that regexp.test always return false, even thouth it should return true.

  const regexp = new RegExp('^\d{4}\/(0?[1-9]|1[012])\/(0?[1-9]|[12][0-9]|3[01])$')

The solution is :

  const regexp = new RegExp(/^\d{4}\/(0?[1-9]|1[012])\/(0?[1-9]|[12][0-9]|3[01])$/)

To replace single quotations(‘) to slash(/) ! Check this website to get more information.