ScratchData LogoScratchData
Back to nembence's profile

JavaScript object list test

NEnembence•Created September 17, 2024
JavaScript object list test
44
37
454 views
View on Scratch

Description

This project doesn't work on TurboWarp To enter detector mode wait until the end or stop the project, and click and hold the stage for 1 second. Then it will detect when the first sprite is changed. I got the idea of using an object as list here: https://scratch.mit.edu/projects/1068153464/ If an object has the "length" property set to a positive number then Scratch can use it almost like if it was a list. Some blocks don't work though - real lists (arrays) have built-in methods that these blocks use, but JavaScript methods can't be defined in the JSON for safety reasons. I tried out if the default input in custom blocks can be set to an object (through JSON editing) and it works. However if the object is in a list or variable the project won't save and if you download it that file can't be opened. I also tried out if the custom block generates the same or different objects every time and I found that it almost always returns a reference to the same object except when the editor opens the sprite or code is changed.

Project Details

Project ID1069110171
CreatedSeptember 17, 2024
Last ModifiedMay 13, 2025
SharedSeptember 19, 2024
Visibilityvisible
CommentsAllowed