Skip to Main Content
University of Texas University of Texas Libraries

Output.js -

This guide is aimed to provide users with a comprehensive resource to help them navigate and access the Benson's digital content which stems from a variety of projects and departments.

In JavaScript, is a common name for a file used to handle the display or processing of data. Depending on your environment (browser or server-side), there are several ways to output text. Common JavaScript Output Methods

: If you are using Node.js to create a physical file named output.txt , you can use the fs (File System) module's fs.writeFileSync() method as detailed on CodeSignal .

: Directly writes text into the HTML document stream. Note: Using this after a page has loaded will overwrite the entire document. Sample Code for output.js Here is a basic template you can use for your file: javascript

You can output text in a standard .js file using these primary methods:

: Updates the content of a specific HTML element. For example, Tutorial Republic shows how to use document.getElementById("id").innerHTML = "Text" to change what a user sees on a page.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 Generic License.