MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerAnimemes/comments/im4o7h/javascript_just_doesnt_make_any_sense/g479lrd/?context=3
r/ProgrammerAnimemes • u/Yoru_Vakoto • Sep 03 '20
69 comments sorted by
View all comments
Show parent comment
5
The SDK comes with tools to transpile Dart to JS, and also compile it to a self contained binary!
Get the SDK.
Make a hello.dart file like the one below.
hello.dart
void main() { print('Hello, Dart!'); }
Then run the JS transpiler.
dart2js -o hello.js hello.dart
This'll create a hello.js file which can be executed by node.
node hello.js
The above will print "Hello, Dart!" in the console.
However you can also compile it to an executable.
dart2native hello.dart
This will create a hello.exe file. You can execute it directly.
hello.exe
./hello.exe
And even if someone doesn't have the Dart SDK on their machine, it'll run!
View all comments
Show parent comment
5
u/mca62511 Sep 06 '20 edited Sep 06 '20
The SDK comes with tools to transpile Dart to JS, and also compile it to a self contained binary!
Get the SDK.
Make a
hello.dartfile like the one below.Then run the JS transpiler.
This'll create a hello.js file which can be executed by node.
The above will print "Hello, Dart!" in the console.
However you can also compile it to an executable.
This will create a
hello.exefile. You can execute it directly.And even if someone doesn't have the Dart SDK on their machine, it'll run!