Problems of locals.posts and locals.categories types in Hexo

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

Oct.11,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3f03b-2c46a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3f03b-2c46a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?