Skip to primary navigation Skip to main content
US flag signifying that this is a United States Federal Government website An official website of the United States Government USDA United State Department of Agriculture Farm Production and Conservation

JavaScript

All FPAC Applications shall utilize agency best practices for JavaScript and Front-end code related issues.

Agnostic JavaScript

In general, the Design System will be JavaScript agnostic, and will refrain from utilizing or suggesting any JavaScript frameworks or libraries, such as AngularJS and jQuery. Instead, the examples are coded in “Vanilla JavaScript”, which are demo-only and not intended for production use. The general concept of prototypical code is used while developing examples, and production-ready scripting is the responsibilty of Product Teams.

Frameworks VS Libraries

In order to better understand your choices as a Developer, it is crucial to know the difference JavaScript Frameworks and JavaScript libraries. Based on your project needs, your choice of whether to use Vanilla JavaScript or one of the numerous JavaScript frameworks and libraries needs to be informed by FPAC Best Practices.

A JavaScript Framework is a piece of software that is packaged together to solve a specific problem. Frameworks are opinionated, in that they require you to use specific methodologies or syntax to solve the problem. Your code must follow certain arrangements, definitions, or style to work within the framework. The framework dictates your application’s Front-end architecture. Examples of a JavaScript framework include AngularJS, EmberJS, ExpressJS, and ReactJS^.

A JavaScript Library is more of an add-on to a project that performs a very specific task. The software architecture of your project is not dependent on the Library, and in general, multiple libraries can be used in conjuction to form your overall JavaScript Application architecture. A library is generally used to create and implement functionality within your application using individual components or a library of components to solve a problem. Examples of JavaScript libraries include jQuery, and modernizr.

Frameworks:

Libraries:

^particularly when combined with multiple extensions to implicitly form a framework

Return to top