- Docs »
- Netscript »
- Learn to Program in Netscript
- Edit on GitHub
Netscript is simply a subset ofJavaScript,with some additional functions added in to allow interaction with the game.
For Beginner Programmers¶
If you have little to no programming experience, that’s okay! You don’t need to bea great programmer in order to enjoy or play this game. In fact, this game couldhelp you learn some basic programming concepts.
Here are some good tutorials for learning programming/JavaScript as a beginner:
- Learn-JS
- programiz
- Speaking JavaScript
- This is a bit on the longer side. You can skip all of the historicalbackground stuff. Recommended chapters: 1, 7-18
For Experienced Programmers¶
The following section lists several good tutorials/resources for those who have experienceprogramming but who have not worked extensively with JavaScript before.
Before that, however, it’s important to clarify some terminology about the differentversions of JavaScript. These are summarized in this article:
WTF is ES6, ES8, ES2017, ECMAScript…
An important takeaway from this article is that ES6, also known as ES2015, introducedmany major features that are commonly seen in modern JavaScript programming. However, thismeans that ES5 engines and interpreters will fail if they encounters these ES6 features. You’ll see why thisis important further down.
- MDN Introduction to JS
- Eloquent JavaScript (ES6+)
- Recommended Chapters: Introduction, 1-6
- Modern Javascript Tutorial (ES6+)
- Recommended Chapters: 2, 4-6
Netscript 1.0 vs Netscript 2.0¶
There are two versions of Netscript:
Visit the pages above to get more details about each version. If you are newto programming or unfamiliar with JavaScript, I would recommend starting outwith Netscript 1.0. Experienced web developers can use NS2to take advantage of faster speeds and additional features.
Here is a short summary of the differences between Netscript 1.0 and Netscript 2.0:
Netscript 1.0
- ES5
- Some ES6 features implemented with polyfills
- Slow compared to NetscriptJS (interpreter runs at the “Netscript Exec Time” speed configured in options)
- Compatible with all browsers
Netscript JS (Netscript 2.0)
- Supports (almost) all features of modern JavaScript
- Extremely fast - code is executed as an Async Function
- Works on most modern browsers.
- Each script becomes a module and therefore all instances of that script can easilyshare data between each other (essentially global/static variables)