[New post] Microbit: Using JAVAScript N Static TypeScript
ants123456789 posted: " Microbit development environment mainly uses 3 main programming language. Having able to switch from Block, Micropython and Javascript in Makecode environment. Remember in our past microbit article, we had covered Block and Micropython programming Let d"
Microbit development environment mainly uses 3 main programming language. Having able to switch from Block, Micropython and Javascript in Makecode environment. Remember in our past microbit article, we had covered Block and Micropython programming Let discuss on Javascript coding for MIcrobit.
Using Block to Javascript
MakeCode is meant for teaching programming first, and JavaScript second. For this reason, Microsoft has stayed away from concepts that are specific to JavaScript (for example, prototype inheritance).
Open a block project in Makecode and drag show leds and show leds block.
Switch to Javascript and you can find the code written.
Well the environment will check for any syntax and coding formatting error.
You can find an introduction to JavaScript with MakeCode:
Both Blocks and Static Python are converted to Static TypeScript before being compiled to lower-level languages.
STS is the core language supported by the MakeCode Framework.
A STS program is compiled to machine code in the browser and linked against a precompiled C++ runtime, producing an executable.
The prevalent embedded interpreter approach, extending battery life and making it possible to run on devices with as little as 16 kB of RAM.
STS eliminates most of the "bad parts" of JavaScript; following StrongScript, STS uses nominal typing for statically declared classes and supports efficient compilation of classes using classic techniques for vtables.
STS toolchain runs offline, once loaded into a web browser, without the need for a C/C++ compiler – the toolchain, implemented in TypeScript, compiles STS to Thumb machine code and links this code against a pre-compiled C++ runtime in the browser.
STS compiler generate compact machine code, which unlocks a range of application domains such as game programming for low resource devices.
Finally, if you need to understand some basic javascript, you can refer back our old javascript article.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.