Learn JavaScript in Construct, part 13: Onwards

17

Index

Features on these Courses

Stats

4,490 visits, 9,691 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY-NC 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 16 Dec, 2021. Last updated 19 Jul, 2024

This is the final part 13 of the tutorial series Learn JavaScript in Construct. This part follows on from part 12. So in case you missed it, see Learn JavaScript in Construct, part 12: Modules.

We've covered most of the language basics of JavaScript in this guide. However as we noted at the start, this guide does not comprehensively cover the entire language. It would be a much longer guide if it did! JavaScript is a mature language with a wide range of sophisticated features, and is continuously improving over time as well with new additions, performance improvements and more.

This final part of the guide has some closing remarks, a bit of advice, some final details about JavaScript that weren't covered before, and pointers on where to go next. The goal of this guide is to teach you enough that you will now be comfortable using the wide range of other JavaScript resources across the web to learn more and know how to apply it in Construct. We've included a series of links you can use more and suggest what to focus on next. There's a lot you can go in to though, so these are just suggestions - if you know what you want to be working on, you might want to focus on other specific areas relevant to that.

More guides

This guide has introduced you to the basics of the JavaScript language. There are other guides on the web that go in to detail about every aspect of JavaScript. You can use these to refresh your knowledge, learn about the topics we covered in this guide in more detail, and learn about new parts of JavaScript this guide did not cover.

Here are some guides that you can take a look at:

  • javascript.info provides a free guide with three major parts going in to detail on the JavaScript language, the browser APIs like the DOM, and an additional part covering extra details like networking and regular expressions.
  • The MDN Web Docs guide on JavaScript is another free reference, focused on web development. This site also provides the JavaScript Reference that we've linked to throughout this guide. The MDN Web Docs are the de-facto official reference for web technologies like JavaScript.
  • Learn JavaScript on web.dev is another detailed and free to read course going further than this guide.
  • learnjavascript.online is an interactive online resource for learning JavaScript that provides the first several chapters for free, but note going further requires payment.

Search the web and you'll find loads more resources, both free and paid, such as Codecademy.com, code.org, freeCodeCamp.org, Edabit, and more.

To learn more about how JavaScript works in Construct, also refer to the scripting section of the documentation. The guides on Javascript in Construct, Scripts in event sheets and Script files include important information about how JavaScript is used in Construct specifically. There's also a guide on Debugging script to help you get started with some of the more advanced debugging tools provided by browser's developer tools.

What to learn next

Here are some ideas about what to look in to learning next if you want to expand your knowledge of JavaScript. They are roughly in order of what we would suggest learning next, but you can of course do things your own way, or follow the order provided by other guides.

  • Classes are a fundamental part of JavaScript programming and provide a wide range of features for object-oriented programming (OOP). If you're not sure where to go next, learning more about classes and everything you can do with them is a good place to move on to. Inheritance is also a key part of OOP which you can use in classes with the extends keyword. If you want to dig in to all the technical details of how inheritance works in JavaScript, see Inheritance and the prototype chain.
  • There are more operators you can use like bitwise ~, &, |, ^; bit shifts << and >>; and nullish coalescing ??.
  • JSON is a useful data format based on how object literals are written in JavaScript. It's also useful in Construct with the JSON plugin. See JSON.parse() and JSON.stringify().
  • Exceptions are a useful way for handling errors. See try...catch and Control flow and error handling.
  • async functions, the await operator, and promises are useful for dealing with asynchronous (i.e. long-running) tasks like downloading resources from the network.
  • Regular expressions provide useful and advanced tools for processing text. Construct also allows these to be used in event sheets with some system expressions.
  • There are lots of Web APIs browsers provide, such as fetch for making network requests, WebSockets for real-time communication, Web Workers for running code in a background thread, Web Crypto for various cryptographic tools, Web Audio for audio playback, and much more.
  • There are lots of useful coding patterns to learn about such as Immediately Invoked Function Expressions (IIFEs), currying, advanced function methods like bind(), call() and apply(), and plenty more.
  • TypeScript extends JavaScript with static typing, providing useful tools such as better autocomplete. See Using TypeScript in Construct for more information.

Debugging code is also useful to learn to help diagnose code that isn't working correctly. It lets you do things like step through your code line-by-line showing what the values of all the variables are, so you can see exactly what it's doing and where it goes wrong. The Debugging script guide in Construct's manual shows how to get started with that.

Start Page examples

Check out the Scripting section of the Start Page for some examples based on JavaScript code, ranging from basic examples to a fully JavaScript-coded version of the Ghost Shooter example. Inspecting these will help you learn more about JavaScript and how to use it in Construct.

Getting help

For general programming questions, StackOverflow.com is a well-known resource for asking questions and getting help, as well as an invaluable resource of past questions and answers where you can often find someone else who had the same problem and the answer that solved their problem.

If you have a problem specific to coding in Construct, such as using scripts in event sheets or using Construct's own APIs, try asking in the Scripting forum.

  • 5 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • Hello. Why don't you recommend using for-in? I did not find any article where they preferred to use for-of or Object keys, values and entries instead of for-in.

    Here I found an article with a benchmark, which talks about the results of for-in, for-of and Object keys, values and entries. hackernoon.com/3-javascript-performance-mistakes-you-should-stop-doing-ebf84b9de951

    Object iterate For-In, average: ~240 microseconds

    Object iterate Keys For Each, average: ~294 microseconds

    Object iterate Entries For-Of, average: ~535 microseconds

    Why shouldn't I use it if it's faster?

  • Thanks for such a great series. As a game designer who's written a fair amount of code in Unreal Blueprint, C# for Unity, and Actionscript 3 for Flash, this was a great overview of the basics of JS - the best I've read. Something like this aimed at writing addons for Construct would be very helpful too, but in any case I really enjoyed this. Thank you.

  • This tutorial was long overdue. thx!

  • Great tutorial thank you so much.

  • thanks for being with us!