JS++ first appeared on October 8, 2011.123 The modern implementation was announced at DeveloperWeek 20164 and released on May 31, 2016.5678 The language is designed by Roger Poon and Anton Rapetov.
Since JS++ is a superset of JavaScript, declaring data types for variables is optional. However, when types are declared, the types are enforced at both compile time and runtime.
Type annotations in JS++ use the traditional C syntax:
Notably, this differs from TypeScript and ActionScript, which use a more verbose style:
The type system in JS++ is sound for ECMAScript and DOM API corner cases, including host objects, dynamic key-value pairs, Comet, JScript conditional compilation, dynamic return types, ActiveX, ECMAScript for XML, web browser garbage collector and cyclic reference counting bugs, conditional logic, and other corner cases.910 This differs from other JavaScript supersets where types are optional and discarded at runtime via type erasure, such as in TypeScript.1112
JS++ can use JavaScript libraries using the one-line external statement as in the following example from the homepage of JS++:
While classes in JavaScript (ECMAScript 6) are syntactic sugar for prototypes under the hood,13 JS++ classes resemble the classes found in classical programming languages such as C++, Java, and C# in terms of memory layout, performance, and semantics. For example, private methods are private at both compile time and runtime, and external JavaScript objects cannot access private JS++ fields or methods.
The following source code illustrates object-oriented sorting in JS++ using the IComparable<T> interface and Comparison enumeration for type-safe and readable comparisons.14 The custom sorting logic is one line of code in the overridden compare method below:
Thus, in the code above, the custom sorting logic provided is:
Likewise, to call the sort:
For printing the sorted results:
The join method will call the overridden toString method on each individual object, which concatenates the employee's first and last names.
JS++ provides encapsulation by default. In the following example, the fields x and y are private by default, even if no access modifier is specified. The methods getX() and getY() are public by default. This enables a more concise class definition syntax, as illustrated in the Point class below:15
An out-of-bounds access usually occurs with arrays. For example, when we access the 100th element of a 3-element array, we have an out-of-bounds access:
In Java and C#, this can result in an exception and program termination. In C, this can result in buffer overflows or segmentation faults. C++ has varying semantics, such as default initialization, exceptions, segmentation faults, or buffer overflows.1617
JS++ can efficiently analyze out-of-bounds errors at compile time.181920
JavaScript has the notion of null and undefined values, where null means a value is present but it's an empty value, and undefined means there isn't a value there at all. JS++ extends this intuition further to differentiate between empty values and out-of-bounds accesses.21
Consider the following code, with a nullable int type represented with int?:
While nullable types can represent an out-of-bounds access, it falls apart when the array might contain nullable values as illustrated above. Instead, JS++ introduces an additional concept in addition to null values: undefined values. Recall that JS++ extends the JavaScript notion that null means a value is present but is an empty value, while an undefined value means a value does not exist at all. JS++ uses the concept of "a value does not exist at all" to mean an out-of-bounds access has occurred, and this concept is known in JS++ as "existent types."22
Therefore, the previous example can be amended. The existent type int+ means "int or out of bounds" and int?+ means "int, null, or out of bounds":
Intuitively, this means existent types cannot be used as the underlying type for array elements. JS++ enforces this at compile time:
The JS++ compiler is available for Windows, macOS, and Linux. It is a source-to-source compiler which emits JavaScript source code as an intermediate representation.
JS++ integrates with various code editors including Visual Studio Code, Atom, and Sublime Text.232425
JS++ can be integrated with third-party build tools like Webpack.26
"JavaScript++: New, Powerful Language for Better Web Development". 17 October 2011. Archived from the original on 17 October 2011. https://web.archive.org/web/20111017221312/http://jspp.javascript.am/ ↩
"C++ et Javascript = Javascript++". La ferme du web. 12 October 2011. Archived from the original on 12 October 2011. https://web.archive.org/web/20111012143226/http://www.lafermeduweb.net/veille/c-et-javascript-javascript-123284133702156289.html ↩
"Index of /downloads". 18 October 2011. Archived from the original on 18 October 2011. https://web.archive.org/web/20111018172906/http://jspp.javascript.am/downloads/ ↩
"JavaScript Conference - DeveloperWeek 2016 - February 12–18". 13 February 2016. Archived from the original on 13 February 2016. https://web.archive.org/web/20160213204925/http://www.developerweek.com/javascript-conference/ ↩
Poon, Roger (May 31, 2016). "JS++ Goes Into Public Beta". Onux.com. https://www.onux.com/jspp/blog/jspp-goes-into-public-beta/ ↩
Handy, Alex (June 1, 2016). "Onux seeks to fix JavaScript's lack of type safety". SD Times. http://sdtimes.com/onux-seeks-fix-javascripts-lack-type-safety/ ↩
Krill, Paul (June 6, 2016). "New compiler tackles JavaScript's weak typing". InfoWorld. https://www.infoworld.com/article/3079092/javascript/new-compiler-tackles-javascripts-weak-typing.html ↩
Cimpanu, Catalin (June 9, 2016). "jQuery 3.0 Released and Other JavaScript News". Softpedia. https://news.softpedia.com/news/jquery-3-0-released-and-other-javascript-news-505064.shtml ↩
"The JS++ Type System, Appendix B: Problems (Why was this hard to solve?)". Retrieved 10 February 2020. https://www.onux.com/jspp/tutorials/type-system#Appendix-B ↩
US patent 10296313, Roger Poon, "Safely consuming dynamically-typed code from a statically-typed programming language", published 2019-05-21 http://patft1.uspto.gov/netacgi/nph-Parser?patentnumber=10296313 ↩
Bridgwater, Adrian (June 13, 2016). "Onux JS++, an answer to JavaScript 'brittle' type safety?". Computer Weekly. Archived from the original on 2016-07-22. https://web.archive.org/web/20160722151154/http://www.computerweekly.com/blog/Open-Source-Insider/Onux-JS-an-answer-to-JavaScript-brittle-type-safety ↩
"The JS++ Type System". Onux.com. https://www.onux.com/jspp/tutorials/type-system ↩
"Classes". MDN Web Docs. Retrieved 2025-06-20. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes ↩
Poon, Roger (May 28, 2019). "Tips & Tricks: Object-oriented Sorting in JS++ with IComparable". Retrieved June 20, 2025. https://www.onux.com/jspp/blog/tips-tricks-object-oriented-sorting-in-jspp-with-icomparable-t/ ↩
Poon, Roger (June 10, 2018). "Tips & Tricks: Only Fields are 'private' by Default". Retrieved June 20, 2025. https://www.onux.com/jspp/blog/tips-tricks-only-fields-are-private-by-default/ ↩
"std::unordered_map::operator[] - cppreference.com". en.cppreference.com. Retrieved June 20, 2025. https://en.cppreference.com/w/cpp/container/unordered_map/operator_at.html ↩
"std::unordered_map::at - cppreference.com". en.cppreference.com. Retrieved June 20, 2025. https://en.cppreference.com/w/cpp/container/unordered_map/at.html ↩
Díaz, Fabio (January 23, 2019). "JS++, the JavaScript superset, is getting rid of out-of-bounds errors". Akuaroworld. https://www.akuaroworld.com/js-the-javascript-superset-is-getting-rid-of-out-of-bounds-errors/ ↩
Cardoza, Christina (January 16, 2019). "JS++ programming language looks to solve out-of-bounds errors". SD Times. https://sdtimes.com/softwaredev/js-programming-language-looks-to-solve-out-of-bounds-errors/ ↩
Poon, Roger (January 11, 2019). "JS++ 0.9.0: Efficient Compile Time Analysis of Out-of-Bounds Errors". Onux.com. https://www.onux.com/jspp/blog/jspp-0-9-0-efficient-compile-time-analysis-of-out-of-bounds-errors/ ↩
"JavaScript superset JS++ adds dead code elimination and more". Computerworld. October 19, 2016. http://www.computerworld.com/article/3132920/application-development/javascript-superset-js-adds-dead-code-elimination-and-more.html ↩
Cardoza, Christina (October 19, 2016). "JS++ 0.4.2 released with code editor integrations, modules and dead code elimination". SD Times. http://sdtimes.com/js-0-4-2-released-code-editor-integrations-modules-dead-code-elimination/ ↩
Clark, Geneva (October 20, 2016). "JS++ 0.4.2 Release - Upgraded With Modular Design, Dead Code Elimination, and Multiple Code Editors". Zeomag. https://www.zeolearn.com/magazine/jspp-0.4.2-release-with-upgrades ↩
Phoenix, Ingwie (7 December 2018). "Proof of Concept: Using JS++ with WebPack". GitHub. Ingwie Phoenix. https://github.com/IngwiePhoenix/jspp-webpack-poc ↩