IoT device Shelly JavaScript engine cannot sort arrays - Stack Overflow

I have very limited knowledge of JavaScript. Trying to script my IoT device with the help of a known LL

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?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745103364a4611410.html

相关推荐

  • IoT device Shelly JavaScript engine cannot sort arrays - Stack Overflow

    I have very limited knowledge of JavaScript. Trying to script my IoT device with the help of a known LL

    12小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信