Wednesday, November 23, 2022

🆕 _CONSOLELOG statement

The _CONSOLELOG function sends the string resulting from some string expression to the browser's web console.

Syntax

_CONSOLELOG (strExpression)

  • strExpression can be a simple literal string or a string expression of any complexity


Useful for debugging programs by strategically placing instances in a program to let you know what part of your program executed and what values certain values may have.

To have an opportunity to open your browser's web console, make sure to setup some kind of delay to your program which gives you time to right click on the program's console window, and tell your web browser to open the web console.

The _ALERT statement is perfect for pausing the program and diving you the time to open the web console.  You might also want to consider an _ALERT statement right after a _CONSOLELOG statement to give you time to review the web console before continuing the program.

Code sample:

<<debug """

    _alert("open your browser Developer Tools to access your browser console.")

""">>

greet$ = "good day ladies and gentlement, this is the production version of the program"

<<debug """

    _consolelog("greet$ = " + greet$)

    _alert("paused for web console review")

""">>

print greet$





No comments:

Post a Comment

🖥 Fan Dance

This is a port and mod of a SpecBAS program by ZXDunny. Run the program View the source code And, a "less is more?" version: Run t...