0

let big1 = ('B$ig d$reams pay$')
let big2 = big1.replace(/\$/gi, "")
console.log(big2)

what's the logic of using /\ in this case

rioV8
  • 24,506
  • 3
  • 32
  • 49
  • `/` is the beginning of a regular expression and `\$` means a literal `$` (the \ prevents the `$` from being interpreted as having a special meaning). – Rocky Sims Sep 15 '22 at 08:00
  • The `/___/gi` is a regular expression literal. The `\$` inside it says to match a dollar sign literally (without the backslash in front of it, `$` has special meaning in regular experssions: it means "end of input" or "end of line" [if the `m` flag is used]). – T.J. Crowder Sep 15 '22 at 08:01

0 Answers0