سؤال

Here's how the string comes to existence:

presidentsname = ((lista[number]).split("|")).slice(0,1);
document.diagnostic.window1.value=presidentsname+"    " +presidentsname.length;

with Hollande the name shows properly, but the length turns out to be 1

how to modify presidentsname.length in order to obtain 8?

or must the error be elsewhere?

هل كانت مفيدة؟

المحلول

presidentsname is in this case an array with one element

you can put a line between the two:

presidentsname = presidentsname[0];

نصائح أخرى

Yes, you are getting the length of the array and not the length of the String.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top