Answer the question
In order to leave comments, you need to log in
Does not convert a string to an array. Why? How to convert?
Hello.
Faced such a problem.
1. There is a JSON file consisting of {
"category": "moykistal",
"name": "Polygran F-05 sink",
"price": 2990,
"preview": "img/f05beige-min.png",
"photos ":
[
"f05beige-min.png",
"f05black-min.png",
"f05green-min.png",
"f05pink-min.png"
],
"description": "Any, absolutely any text, of course, is better, so that it would be information about the product "
},
2. I merge pictures from photos into the data attribute data-photos.
3.
4. I want to convert the given string to an Array using var arr = names.split('///'); I put the separator /// for clarity
BUT I check arr still f05green-min.png, f05beige-min.png, f05black-min.png, f05pink-min.png without ///. And the typeof check shows the object.
Tell me how to make it so that there is a regular array [f05green-min.png, f05beige-min.png, f05black-min.png, f05pink-min.png] ???
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question