Small Basic Forum
Diving into Z-S's SB.js web program - Printable Version

+- Small Basic Forum (https://litdev.uk/mybb)
+-- Forum: Small Basic (https://litdev.uk/mybb/forumdisplay.php?fid=1)
+--- Forum: Standard Small Basic (https://litdev.uk/mybb/forumdisplay.php?fid=2)
+--- Thread: Diving into Z-S's SB.js web program (/showthread.php?tid=413)



Diving into Z-S's SB.js web program - sm4llprogrammer2008 - 06-25-2025

Z-S shared me a project while I started to create SBJS, and I think it's fast enough, very well engineered.
First I tried this:
Code:
textwindow.writeline("hello, world!");
It probably made sense to include a semicolon, because it maybe was just custom JS objects + classes running with eval() on the background.
Then went on to test some classic SB syntax:
Code:
for i=1 to 5
textwindow.write("Hello, world! ");
endfor
Surprisingly, it worked.
Then tested this:
Code:
uinput = textwindow.read();
textwindow.writeline(uinput);

Also it used the browser's native input box dialog instead of a text cursor within the console.
Then tested JS multiline notes:
Code:
/* Multiline notes
on SB.js */
It was ignored. Didn't throw any errors.
It probably supported my belief of custom JS objects + classes on the background running with eval(). Z-S is truly a web mastermind, and I appreciate that.
Anyway you can try Z-S's SB.js at https://www.zs.rf.gd/SBJS/


RE: Diving into Z-S's SB.js web program - z-s - 06-26-2025

Made sub to work like function and also return value


RE: Diving into Z-S's SB.js web program - sm4llprogrammer2008 - 06-26-2025

Let's go!!!!

Anyways this actually worked!
sub greet(name)
textwindow.writeline("Good morning, "+name+"!")
endsub

greet("sm4llprogrammer2008")

Another program cleverly worked:
sub greet(name)
textwindow.writeline("Good morning, "+name+"!");
endsub

greet("sm4llprogrammer2008");

sub repeat(times)
for i=1 to times
textwindow.writeline("Hello, I repeated "+i+" times!");
endfor
endsub

repeat(10)

Maybe improve conditional branching, adding stuff like if [x] = [y] then ... elseif [x] = [y] then ... endif