Combine parameter value to a variable name in Jquery

By | July 17, 2018
Questions:

I’m trying to pass ‘en’ as a parameter to test function. but I don’t know how to pass the parameter value to a variable to reuse it for other lang. Can anyone help me with this? Thanks in advance

function test() {

  var en_ed = CKEDITOR.instances["story_html"].getData();
  var en_ed_text = en_ed;
  en_ed_text = en_ed_text.replace(/\s/g, "");
  en_ed_text = removeHTMLTags(en_ed_text);
  en_ed_text = Encoder.htmlDecode(en_ed_text);

  if (en_ed_footer == en_ed_text) {
    en_ed_text = "";
  }

}

EDIT
I want to call a function like this – function test(en); en, de … want to pass as a parameter to this test function.

actually, I wrote this function for the English language now. I want to reuse this for other langs. for that, I want to pass other languages to this function. once I passed ‘de’ lang it should be assigned to like –

var de_ed = CKEDITOR.instances["story_html"].getData();
var de_ed_text = de_ed;
Answers:

Leave a Reply

Your email address will not be published. Required fields are marked *