0

I have a Javascript object that looks like this:

 Object { .import_236="["100", "200"]"}

if I use:

{ .import_236="["100", "200"]"}[key][0]

It returns me only first character of array...

1
  • It returns the first character because it is not an array, but a string (double quotes). If you want it to be an array, loose the outer double quotes. Also, there are a lot of syntax errors in your code. Commented Jun 18, 2015 at 7:39

2 Answers 2

1

yes you can do something like

 var obj= { 
   '.import_236':["100", "200"]
}

and to access you can use

console.log(obj['.import_236'][0])
Sign up to request clarification or add additional context in comments.

Comments

1

If your object has a name like : myObject = { .import_236="["100", "200"]"}

You can do something like this : myObject['.import_236']. I believe it will return "["100", "200"]"

Hope it Helps

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.