Skip to main content
Enchanting_Glitter0D45
Inspiring
April 17, 2016
Question

JSX: Function replace is undefined? What

  • April 17, 2016
  • 1 reply
  • 1008 views

Turns out, the regex's replace function is not supported in my current attempt to understand the ESTK "tool".

Code as simple as:

beta = beta.replace(/\s\s*$/, "");

Same with others replace(). And it's undefined!! I'm assuming match() and others are as well. Syntax, debug and everything is set to javascript. I tried both connected to Ae and otherwise.

What am I missing?

This topic has been closed for replies.

1 reply

Mathias Moehl
Community Expert
Community Expert
April 17, 2016

The replace function is defined for strings, hence, most likely in your code you didn't ensure that beta is a string.

// works

var beta = "foo    ";

beta = beta.replace(/\s\s*$/, "");

// does not work, since alpha is a number and not a string

var alpha = 1;

alpha = alpha.replace(/\s\s*$/, "");

// does not work since gamma is undefined and not a string

gamma = gamma.replace(/\s\s*$/, "");

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects