problem description
Hexo theme development found that locals.posts locals.categories behaves like an array, and you can use methods such as map, sort, and so on. But it"s not exactly an array, for example, you can"t use for.of.. Iterate.
got very confused
the environmental background of the problems and what methods you have tried
tried typeof, and turned out to be object?
lists keys, including data and length,data that are empty (? ), length has a normal value
looks like an array, but if you use
posts = [] .concat (locals.posts) cannot be used, and many methods report errors, such as sort, slice
what result do you expect? What is the error message actually seen?
is curious about the type and wants to know what"s going on
at the same time, I want to know how to use the console output of hexo. I copied the code in the document without output
.all the above contents are run in the js file under the theme script folder