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

JS question: does list have value

Participant ,
Sep 06, 2021 Sep 06, 2021

Copy link to clipboard

Copied

Good day honorable adobe forum members,

 

I am looking for the method to use to check if a value is in a list

 

i.e.:

 

var list = ["A","B","C"]

if ("a"  in list) {
//dothings
}

 

Hoe does one do this effectively?

 

Thank you in advance for any and all trouble to be taken

TOPICS
Acrobat SDK and JavaScript , Windows

Views

232

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Sep 06, 2021 Sep 06, 2021

Yes, using the indexOf method. See: https://www.w3schools.com/jsref/jsref_indexof_array.asp

 

Votes

Translate

Translate
Participant ,
Sep 06, 2021 Sep 06, 2021

Copy link to clipboard

Copied

I see I typed "a" instead of "A" , I hope this doesn't cause confusion (the example should say "A") 

Votes

Translate

Translate

Report

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 ,
Sep 06, 2021 Sep 06, 2021

Copy link to clipboard

Copied

Yes, using the indexOf method. See: https://www.w3schools.com/jsref/jsref_indexof_array.asp

 

Votes

Translate

Translate

Report

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
Participant ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

Thank you try67, your presence on these boards is a godsend.

 

Thank you very much once more.

Votes

Translate

Translate

Report

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 ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

LATEST

You're very welcome!

Votes

Translate

Translate

Report

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