最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

IoT device Shelly JavaScript engine cannot sort arrays - Stack Overflow

programmeradmin1浏览0评论

I have very limited knowledge of JavaScript. Trying to script my IoT device with the help of a known LLM, I boiled down my issues to this:

let testArray = [3, 1, 2];
print("Does sort exist?", typeof testArray.sort);  // Should print "function"

returning:

Does sort exist? undefined

So it looks like Shelly's version of JavaScript (Espruino, according to this) does not have .sort on arrays. Printing the type of testArray gives array, not Array.

It looks to me that scripting from within this Shelly device is going to be frustrating, as it seems not to follow a recent standard version of JavaScript.

Do I misunderstand something? Is there something I can do to make my Shelly Pro 1 sort an array?

发布评论

评论列表(0)

  1. 暂无评论