Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

basic js functions give error

Community Beginner ,
May 22, 2016 May 22, 2016

I have been developing a script incrementally and it's being executed fine.

When I started to refine it, some "basic" javascript functions get an error when I run the script:

     expression.function(...) is not a function

for instance,

     string.replace("a","b");

or

     date().getfullyear()

Dave

TOPICS
Scripting
426
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
May 22, 2016 May 22, 2016
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
May 22, 2016 May 22, 2016
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 23, 2016 May 23, 2016
LATEST

.replace() is a text function, so if xyz.replace('a','b') throws the error '. . . is not a function', then xyz is probably not text, but some text object. In that case, you need xyz.contents.replace('a','b').

Peter

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines