Well, when i'm trying to use the array like this let titles = ["Julian","August"] the .sort() works, but when i try to use like that
function showTitles(jsonObj) {
let filmes = jsonObj.filmes;
for (let i = 0; i < filmes.length; i++) {
let titles = [];
titles.push(filmes[i].title);
console.log(titles.sort());
}
}
doesn't work. I have a json of objects with titles and I want to sort this alphabetically.
the json:
{
"filmes": [
{
"id": "01",
"title": "Os Simpsons O Filme",
"url": "https://youtu.be/KCpcGsFl90c",
"image": "sMcsZ7BlOf2LDhTlfPlWb3w6lJM.jpg",
"sinopse": "Homer Simpson.",
"time": "1h:26m",
"quality": "720p",
"latestAdded": false,
"problem": false,
"release": "27/07/2007",
"version": "Dublado",
"gender": [
"Animação",
"Comédia"
]
}
}
Please if someone knows how to do this works, help me :/