var reg = new RegExp('(s)$'); //Note that the expression is not contained within backslashes.
var regexp = new RegExp("w+"); console.log(regexp); // expected output: /w+/