Javascript – How can I replace all instances of 'x' within a string as long as 'x' is within Math.sin(), Math.cos(), or Math.tan()?
I am trying to write a JavaScript replaceAll() with a RegEx that will replace every value of x with period*x, as long as it is within Math.sin() or Math.cos() or Math.tan() I tried this: let fx = 'Math.tan(Math.sin(Math.cos(x)*x)*x)'; const periodRegEx…