Skip to content
Droidscript
Share
Explore
Droidscript v2

JavaScript

To create apps using Droidscript, one must understand a little JavaScript; in this video, I explain that little bit of JavaScript.
Video
Loading…
Basic JavaScript
Variable
var name = "Linc";
var age = 120;
var droidscriptIsCool = true;
var randomNames = ["Linc", "Codes"];
randomNames[0] //"Linc"
var objNames = {name: "Linc", age:120};
objNames.age //120

Statements
if(condition){
//code
}else if(another condition){
//code
}else{
//code
}

Loops
while(condition){
//code
}

for(declaration; condition; in/decrement){
//code
}
Function
function nameOfFunction(){
//code
}

nameOfFunction(); //calling a function
JS Code
JS Code.apk
4 MB
Long Press the link above to download the APK file.
JS Code code
cfg.Light;

function OnStart() {

lay = app.CreateLayout("Linear", "Center");
run = app.AddButton(lay, "Run");
run.SetOnTouch(running);

code = app.AddCodeEdit(lay, "", 1, 0.95);
code.SetLanguage(".js");
code.SetPadding(0.01,0.01,0.01,0.01);

app.AddLayout(lay);
}

function running() {
app.Execute( code.GetText() );
}
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.