Discuss Scratch
- Discussion Forums
- » Questions about Scratch
- » How do I use Javascript in scratch???
- dhuls
- Scratcher
1000+ posts
How do I use Javascript in scratch???
While Scratch 3.0 is made in JavaScript, there is no, and there never will be, an official way to run JavaScript in a Scratch project. You're gonna have to make an engine yourself or use one that's already made, since both Scratch and JavaScript are Touring Complete.
- mybearworld
- Scratcher
1000+ posts
How do I use Javascript in scratch???
You can't – and adding such a feature is rejected.
2.2 Text-based syntax in Scratch
Some users wish to code Scratch not with the blocks, but with typing code instead (similar to how more advanced programming languages work). Others are interested in an option to view, convert, or download Scratch code to other programming languages. However, the Scratch Team has discussed this possibility multiple times and has decided every time that it would not be beneficial for beginners or teachers.
This suggestion extends to coding, viewing, converting, or downloading Scratch in any text-based language, including BBCode, Javascript, some form of pseudocode, or some other programming language. If you wish to code using another language, then you can learn it on your own, but it would have to be done outside of Scratch. For those who are interested, it may be worth checking out Tosh. It is a text-based programming language that serves as a text editor for Scratch projects.
Signatures are the only place where assets links still work.
- LucaVmu
- Scratcher
1 post
How do I use Javascript in scratch???
Go to Turbowarp and click extensions. Select custom extension and under text paste following:
but replace “//insert code here” with your Javascript code. Remember your project will only work on Turbowarp from here on!
Your block should look like this:
(function(ext) {
ext._shutdown = function() {};
ext._getStatus = function() {
return {status: 2, msg: ‘Swag’};
};
ext.run_code= function() {
// insert code here
};
var descriptor = {
blocks: [
,
]
};
ScratchExtensions.register('JavaScript Code Runner', descriptor, ext);
})({});
but replace “//insert code here” with your Javascript code. Remember your project will only work on Turbowarp from here on!
Your block should look like this:
Run Custom JavaScript Code :: #000000
- Discussion Forums
- » Questions about Scratch
- » How do I use Javascript in scratch???