javascript/json .length returning 1 for array of length 3 -


मेरे पास निम्न जावास्क्रिप्ट है:

  var email_array = ["[\" theiremail1 \ ", \" theiremail2 \ ", \" theiremail3 \ "]"]; Var email_array_length = emails_array.length; चेतावनी ("ईमेल सरणी:" + ईमेल_अरे + "ईमेल सरणी लंबाई:" + emails_array_length);   

इस कोड के परिणाम के रूप में प्रकट होने वाला चेतावनी है:

  ईमेल सरणी: ["theiremail1", "theiremail2", "theiremail3"] ईमेल सरणी लंबाई: 1   

यह क्यों नहीं लौट रहा है?

< p> यह केवल एक आइटम के साथ एक सरणी है:
  var email_array = ["[\" theeremail1 \ ", \" theeremail2 \ ", \" theiremail3 \ "]"];];   

आप के बाद होने की संभावना क्या है:

  var email_array = JSON.parse (["[\" theiremail1 \ ", \" theeremail2 \ ", \ "theiremail3 \"] "]);   



Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -