# Node.js

This guide explains how to use ADSJS with CommonJS module format which is usually default for Node.js projects.

To add ADSJS into your project run the following command in terminal (from project directory):

```bash
npm install ads-js
```

Then give it a try in your source code:

```javascript
const SinglyLinkedList = require('ads-js').SinglyLinkedList;
// or
const SinglyLinkedList = require('ads-js/lists').SinglyLinkedList;

const list = new SinglyLinkedList([1, 2, 3]);
const position = list.getLast();

console.log(position.element);
```

Visit [PUBLIC API](/adsjs/api/how-to-read.md) section to get further details about capabilities of this library.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://alex-myznikov.gitbook.io/adsjs/getting-started/nodejs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
