So, I was making a JavaScript encryptions into
but the encryption doesn’t work so, can you help me?
First, you mixed up the variables (key) and (text) in the inputs of the call () block.
Second, you meant text.toString(), not toString(text). toString() would attempt to convert the global object to a string.
Also, is there a reason you wanted to use JS instead of implementing it in Snap!? Not to bite you, just letting you know that posting asking for JS help is a thing frowned upon in this forum.
I’m implementing it in snap but why not?
For the range regex you can use (unicode of [A]) ≤ (unicode of (char)) ≤ (unicode of [Z]) @:> ::predicate operators,
the charCodeAt can be replaced with the unicode of [] block,
and the fromCharCode can be replaced with unicode () as letter.
what they mean is you’re just wrapping a javascript function in snap! instead of making it using the various blocks provided in the snap! ide. it’s frowned upon because technical users like @jens (who is one of the mods of these forums) would prefer users to make things that can be reasonably made in snap! like this function that uses operations mostly available in snap! instead of “cheating” in this way. if you had a more complex project that couldn’t be made with just the vanilla blocks alone, like, say, something to do with messing with the underlying morphic system, or allowing usb devices to be used via the webusb api, then that would be a reasonable usecase for javascript, but only to wrap just the things you need to get out of said api into blocks.
Jens is actually the main developer who works on the Snap source code.
i know, i just thought that the fact that they have lots of technical experience with snap! would be enough to point out the general “style guide” of javascript-enabled blocks
