JavaScript flow charts
Help » Languages » JavaScript
Visustin generates flow charts from JavaScript code. ASP and HTML files containing JavaScript are also supported.
- JavaScript syntax support is current as of ECMAScript 2016 (7th edition) and earlier.
- Support is compatible with browsers such as Internet Explorer, Firefox, Opera, Chrome, and jQuery.
- JScript .NET works too although we haven't tested it thoroughly.
- Support covers plain JavaScript (*.js), server-side (ASP) and client-side (HTML) scripting.
- Both semicolons and semicolon-less JavaScript are supported.
- Object-oriented and prototype-based programming is supported.
Supported statements
The following statements are supported.
- if..else
- switch
- while, do..while
- for
- break
- continue
- return
- yield
- with
- try..catch..finally, throw
- function declarations, function expressions
- class declarations, class expressions
- line labels
- comments
Other statements are supported but have no specific visualization.
Embedded JavaScript
Visustin flowcharts plain JavaScript and also JavaScript embedded on HTML or ASP pages. Visustin automatically detects the language mode, which is one of the following:
- ASP Server-side JavaScript (*.asp)
- Everything within
<%...%>
is assumed to be JavaScript.
- Used when:
<%
or %>
are found.
- HTML Client-side JavaScript (*.html)
- Flowchart the code within
<SCRIPT>...</SCRIPT>
tags. Everything else is HTML.
- Used when: Code is HTML but no ASP
<%
tag exists.
- Plain (*.js)
- The code is flowcharted "as is" without HTML.
- Used when: Code is not HTML.
When flowcharting a code snippet (not an entire file), select only the JavaScript code, no HTML tags. Alternatively, include the opening tag <%
or <SCRIPT>
to make Visustin correctly detect the language mode.
If the code contains both server-side and client-side scripts, server-side scripts are flowcharted while client-side scripts are ignored. Remove <%...%>
to flowchart as client-side script.
Where the code mixes several scripting languages, only JavaScript is flowcharted. Use VBScript mode to flowchart VBScript code.
The file extension (*.asp, *.html, *.js) has no actual meaning to Visustin.
Limitations
The following syntax is unsupported or only limited support is provided. The chart may display a normal statement, not a branch or a jump.
- Visustin works at the statement level. The internal structure of complex expressions is not visualized. The conditional expression :? is not split, nor is any short-circuited logic such as && or ||.
- Automatic semicolon insertion (semicolon-less programming) is supported to an extent. If two statements are incorrectly processed as one, add a semicolon between them. If one multiline statement is incorrectly split into two, join the lines.
- The "break label" statement is visualized correctly only if the block that "label" refers to has been visualized by Visustin. You can expect that "break label" works with structures such as while, do and for, but not with structures such as { } that have no specific visualization.
- Two slashes /.../ on the same line may rarely be mistaken for a regex. If a statement break falls between the slashes, Visustin may not notice the two statements correctly. If this happens, add a newline between the slashes.
- Microsoft JScript: Conditional compilation directives (
@if
) are not supported. /*@..@*/
blocks display as regular comments.
©Aivosto Oy – Visustin Help