Our great sponsors
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
You'll find many code snippets below. Most of them come from the source code of Polyglot itself. This article aims to give you more explanations about that code, its purpose, and its use.
Note: Polyglot uses a package called for-each to iterate over both objects and arrays. It acts as a polyfill so that Polyglot doesn't require added methods like Array.prototype.forEach. Suppose you wonder what the third this argument passed to forEach is. In that case, it allows specifying what is this in the callback function (the second argument). In our case, this refers to an instance of Polyglot.